Skip to content

Commit

Permalink
Add build-images workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mikenairn committed Feb 2, 2024
1 parent 0fab71e commit 73a959e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ Dockerfile.cross
*.swp
*.swo
*~

# Temporary files and directories
tmp
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 73a959e

Please sign in to comment.