Skip to content

Commit

Permalink
Merge pull request #521 from securesign/tturek/gh-artifact-oci
Browse files Browse the repository at this point in the history
github-action: Store OCI image as artifact
  • Loading branch information
openshift-merge-bot[bot] authored Nov 28, 2024
2 parents 454e0ed + 1bb2097 commit 93e16f9
Showing 1 changed file with 94 additions and 9 deletions.
103 changes: 94 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
IMG: ttl.sh/securesign/secure-sign-operator-${{github.run_number}}:1h
BUNDLE_IMG: ttl.sh/securesign/bundle-secure-sign-${{github.run_number}}:1h
CATALOG_IMG: ttl.sh/securesign/catalog-${{github.run_number}}:1h
CONTAINER_TOOL: podman

jobs:
build-operator:
Expand All @@ -32,6 +33,16 @@ jobs:
- name: Build operator container
run: make docker-build docker-push

- name: Save container image
run: podman save -o /tmp/operator-oci.tar --format oci-archive $IMG

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: operator-image
path: /tmp/operator-oci.tar
retention-days: 1

build-bundle:
name: Build-bundle-image
runs-on: ubuntu-20.04
Expand All @@ -45,6 +56,16 @@ jobs:
- name: Build operator bundle
run: make bundle bundle-build bundle-push

- name: Save container image
run: podman save -o /tmp/bundle-oci.tar --format oci-archive $BUNDLE_IMG

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bundle-image
path: /tmp/bundle-oci.tar
retention-days: 1

build-fbc:
name: Build-fbc
runs-on: ubuntu-20.04
Expand All @@ -54,13 +75,23 @@ jobs:
uses: actions/checkout@v4

- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@9184318aae1ee5034fbfbacc0388acf12669171f # v1
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: registry.redhat.io
auth_file_path: /tmp/config.json

- name: Download artifact
uses: actions/download-artifact@v4
with:
pattern: "*-image"
merge-multiple: true
path: /tmp

- name: Load images
run: podman load -i /tmp/bundle-oci.tar

- name: Install OPM
run: |
make opm
Expand All @@ -87,8 +118,19 @@ jobs:
cat v4.14/graph.json
${{ env.OPM }} alpha render-template basic v4.14/graph.json > v4.14/catalog/rhtas-operator/catalog.json
${{ env.OPM }} validate v4.14/catalog/rhtas-operator
docker build v4.14 -f v4.14/catalog.Dockerfile -t $CATALOG_IMG
docker push $CATALOG_IMG
podman build v4.14 -f v4.14/catalog.Dockerfile -t $CATALOG_IMG
podman push $CATALOG_IMG
- name: Save container image
run: podman save -o /tmp/catalog-oci.tar --format oci-archive $CATALOG_IMG

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: catalog-image
path: /tmp/catalog-oci.tar
retention-days: 1

build-tuftool:
name: Build-tuftool
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -136,13 +178,23 @@ jobs:
- run: echo "/tmp/tuftool" >> $GITHUB_PATH

- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@9184318aae1ee5034fbfbacc0388acf12669171f # v1
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: registry.redhat.io
auth_file_path: /tmp/config.json

- name: Download artifact
uses: actions/download-artifact@v4
with:
pattern: "*-image"
merge-multiple: true
path: /tmp

- name: Load images
run: podman load -i /tmp/operator-oci.tar

- name: Install Cluster
uses: container-tools/[email protected]
with:
Expand Down Expand Up @@ -261,15 +313,25 @@ jobs:
go-version: ${{ env.GO_VERSION }}

- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@9184318aae1ee5034fbfbacc0388acf12669171f # v1
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: registry.redhat.io
auth_file_path: /tmp/config.json

- name: Image prune
run: docker image prune -af
- name: Download artifact
uses: actions/download-artifact@v4
with:
pattern: "*-image"
merge-multiple: true
path: /tmp

- name: Load images
run: |
podman load -i /tmp/operator-oci.tar
podman load -i /tmp/bundle-oci.tar
podman load -i /tmp/catalog-oci.tar
- name: Install Cluster
uses: container-tools/[email protected]
Expand Down Expand Up @@ -383,7 +445,17 @@ jobs:
auth_file_path: /tmp/config.json

- name: Image prune
run: docker image prune -af
run: podman image prune -af

- name: Download artifact
uses: actions/download-artifact@v4
with:
pattern: "*-image"
merge-multiple: true
path: /tmp

- name: Load images
run: podman load -i /tmp/operator-oci.tar

- name: Install Cluster
uses: container-tools/[email protected]
Expand Down Expand Up @@ -466,13 +538,26 @@ jobs:
kubectl patch storageclass gp2 -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@9184318aae1ee5034fbfbacc0388acf12669171f # v1
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: registry.redhat.io
auth_file_path: /tmp/config.json

- name: Download artifact
uses: actions/download-artifact@v4
with:
pattern: "*-image"
merge-multiple: true
path: /tmp

- name: Load images
run: podman load -i /tmp/operator-oci.tar

- name: Push images
run: podman push $IMG

- name: Create namespace and serviceaccounts with redhat registry login
run: |
kubectl create ns ${{ env.TEST_NAMESPACE }}
Expand Down

0 comments on commit 93e16f9

Please sign in to comment.