[ci] build catalog image #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build images | ||
|
Check failure on line 1 in .github/workflows/build-images-base.yml
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| operatorVersion: | ||
| description: Operator bundle version | ||
| default: 0.0.0 | ||
| type: string | ||
| operatorTag: | ||
| description: Operator tag | ||
| default: latest | ||
| type: string | ||
| 3scaleVersion: | ||
| description: 3scale version | ||
| default: latest | ||
| type: string | ||
| channels: | ||
| description: Bundle and catalog channels, comma separated | ||
| default: preview | ||
| type: string | ||
| defaultChannel: | ||
| description: Bundle default channel | ||
| default: preview | ||
| type: string | ||
| workflow_dispatch: | ||
| inputs: | ||
| operatorVersion: | ||
| description: Operator bundle version | ||
| default: 0.0.0 | ||
| type: string | ||
| operatorTag: | ||
| description: Operator tag | ||
| default: latest | ||
| type: string | ||
| 3scaleVersion: | ||
| description: 3scale version | ||
| default: latest | ||
| type: string | ||
| channels: | ||
| description: Bundle and catalog channels, comma separated | ||
| default: preview | ||
| type: string | ||
| defaultChannel: | ||
| description: Bundle default channel | ||
| default: preview | ||
| type: string | ||
| env: | ||
| IMG_TAGS: ${{ inputs.operatorTag }} | ||
| VERSION: ${{ inputs.operatorVersion }} | ||
| IMG_REGISTRY_HOST: quay.io | ||
| IMG_REGISTRY_ORG: 3scale | ||
| MAIN_BRANCH_NAME: master | ||
| OPERATOR_NAME: 3scale-operator | ||
| jobs: | ||
| # Build operator Docker image | ||
| build: | ||
| name: Build Operator Image | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
| - name: Setup Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: go.mod | ||
| - name: Cache tool binaries | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: bin/ | ||
| key: ${{ runner.os }}-tools-${{ hashFiles('Makefile') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-tools- | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Login to container registry | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ secrets.IMG_REGISTRY_USERNAME }} | ||
| password: ${{ secrets.IMG_REGISTRY_TOKEN }} | ||
| registry: ${{ env.IMG_REGISTRY_HOST }} | ||
| - name: Extract metadata | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }} | ||
| tags: | | ||
| type=raw,value=${{ env.IMG_TAGS }} | ||
| type=raw,value=${{ github.sha }},enable={{is_default_branch}} | ||
| - name: Build and push operator image | ||
| id: build-image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile | ||
| platforms: linux/amd64 | ||
| push: true | ||
| provenance: false | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| build-args: | | ||
| GIT_SHA=${{ github.sha }} | ||
| DIRTY=false | ||
| VERSION=${{ inputs.operatorVersion }} | ||
| build-bundle: | ||
| needs: build | ||
| name: Build Bundle | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v5 | ||
| - name: Setup Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: go.mod | ||
| id: go | ||
| - name: Run make bundle | ||
| id: make-bundle | ||
| run: | | ||
| make bundle | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Login to container registry | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ secrets.IMG_REGISTRY_USERNAME }} | ||
| password: ${{ secrets.IMG_REGISTRY_TOKEN }} | ||
| registry: ${{ env.IMG_REGISTRY_HOST }} | ||
| - name: Extract bundle metadata | ||
| id: bundle-meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}-bundle | ||
| tags: | | ||
| type=raw,value=${{ env.IMG_TAGS }} | ||
| type=raw,value=${{ github.sha }},enable={{is_default_branch}} | ||
| - name: Build and Push Bundle Image | ||
| id: build-bundle-image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./bundle.Dockerfile | ||
| platforms: linux/amd64 | ||
| push: true | ||
| provenance: false | ||
| tags: ${{ steps.bundle-meta.outputs.tags }} | ||
| - name: Print Bundle Image URL | ||
| run: | | ||
| echo "Bundle image(s) pushed:" | ||
| echo "${{ steps.bundle-meta.outputs.tags }}" | ||
| build-catalog: | ||
| needs: [build, build-bundle] | ||
| name: Build Catalog | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v5 | ||
| - name: Setup Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: go.mod | ||
| id: go | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Login to container registry | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ secrets.IMG_REGISTRY_USERNAME }} | ||
| password: ${{ secrets.IMG_REGISTRY_TOKEN }} | ||
| registry: ${{ env.IMG_REGISTRY_HOST }} | ||
| - name: Extract catalog metadata | ||
| id: catalog-meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}-catalog | ||
| tags: | | ||
| type=raw,value=${{ env.IMG_TAGS }} | ||
| type=raw,value=${{ github.sha }},enable={{is_default_branch}} | ||
| - name: Build and Push Catalog Image | ||
| id: build-catalog-image | ||
| env: | ||
| CATALOG_IMG=${{ steps.catalog-meta.outputs.tags }} | ||
| run: | | ||
| make catalog-build | ||
| make catalog-push | ||
| - name: Print Catalog Image URL | ||
| run: | | ||
| echo "Catalog image(s) pushed:" | ||
| echo "${{ steps-catalog-meta.outputs.tags }}" | ||