diff --git a/.github/workflows/build-images.yaml b/.github/workflows/build-images.yaml index 9df23a4c..c5096543 100644 --- a/.github/workflows/build-images.yaml +++ b/.github/workflows/build-images.yaml @@ -108,21 +108,34 @@ jobs: build-catalog: name: Build and Push catalog image - needs: [build-bundle] + needs: [build, build-bundle] runs-on: ubuntu-20.04 steps: - name: Check out code uses: actions/checkout@v4 - name: Run make catalog-build - run: make catalog-build BUNDLE_IMG=${{ needs.build-bundle.outputs.bundle-image }} CATALOG_IMG=${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}-catalog:${{ github.sha }} + run: make catalog-build BUNDLE_IMG=${{ needs.build-bundle.outputs.bundle-image }} + + - name: Build Image + id: build-image + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ env.OPERATOR_NAME }}-catalog + tags: ${{ needs.build.outputs.build-tags }} + context: ./tmp/catalog + dockerfiles: | + ./tmp/catalog/index.Dockerfile + + - name: Print Build Info + run: echo "Image = ${{ steps.build-image.outputs.image }}, Tags = ${{ steps.build-image.outputs.tags }}" - name: Push Image if: github.repository_owner == 'kuadrant' id: push-to-quay uses: redhat-actions/push-to-registry@v2 with: - image: ${{ env.OPERATOR_NAME }}-catalog + image: ${{ steps.build-image.outputs.image }} tags: ${{ steps.build-image.outputs.tags }} registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }} username: ${{ secrets.IMG_REGISTRY_USERNAME }} diff --git a/.gitignore b/.gitignore index 7f02333d..a9b45ed2 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ Dockerfile.cross *.swp *.swo *~ + +# Temporary files and directories +tmp diff --git a/Makefile b/Makefile index eec2cee4..aad38cc6 100644 --- a/Makefile +++ b/Makefile @@ -302,7 +302,7 @@ bundle-push: ## Push the bundle image. $(MAKE) docker-push IMG=$(BUNDLE_IMG) .PHONY: opm -OPM = ./bin/opm +OPM = $(LOCALBIN)/opm opm: ## Download opm locally if necessary. ifeq (,$(wildcard $(OPM))) ifeq (,$(shell which opm 2>/dev/null)) @@ -335,7 +335,9 @@ endif # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator .PHONY: catalog-build catalog-build: opm ## Build a catalog image. - $(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) + mkdir -p tmp/catalog + cd tmp/catalog && $(OPM) index add --container-tool docker --mode semver --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) --generate + cd tmp/catalog && docker build -t $(CATALOG_IMG) -f index.Dockerfile . # Push the catalog image. .PHONY: catalog-push