Skip to content

Commit

Permalink
Fix using docker for catalog & bundle
Browse files Browse the repository at this point in the history
Switch to more direct way to build shortlived bundle
Catalog had to stay with a temporary dockerfile ...
  • Loading branch information
jotak committed May 26, 2023
1 parent f60e28c commit 0598c1b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 41 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/push_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,11 @@ jobs:
- name: build bundle
run: IMAGE_ORG=${{ env.WF_ORG }} VERSION=${{ env.WF_VERSION }} PLG_VERSION=${{ env.WF_VERSION }} FLP_VERSION=${{ env.WF_VERSION }} BPF_VERSION=${{ env.WF_VERSION }} BUNDLE_VERSION=0.0.0-${{ env.WF_VERSION }} make bundle bundle-build
- name: push bundle to quay.io
id: push-bundle
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.WF_IMAGE }}-bundle
tags: v0.0.0-${{ env.WF_VERSION }}
registry: ${{ env.WF_REGISTRY }}
run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=0.0.0-${{ env.WF_VERSION }} make bundle-push
- name: build catalog
run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=0.0.0-${{ env.WF_VERSION }} make catalog-build
- name: push catalog to quay.io
id: push-catalog
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.WF_IMAGE }}-catalog
tags: v0.0.0-${{ env.WF_VERSION }}
registry: ${{ env.WF_REGISTRY }}
run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=0.0.0-${{ env.WF_VERSION }} make catalog-push

codecov:
name: Codecov upload
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push_image_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ jobs:
- name: build and push manifest
run: IMAGE_ORG=${{ env.WF_ORG }} IMAGE=${{ env.WF_REGISTRY }}/${{ env.WF_IMAGE }}:${{ env.short_sha }} make manifest-build manifest-push
- name: build bundle
run: IMAGE_ORG=${{ env.WF_ORG }} VERSION=${{ env.short_sha }} PLG_VERSION=main FLP_VERSION=main BPF_VERSION=main BUNDLE_VERSION=0.0.0-${{ env.short_sha }} make bundle shortlived-bundle-build
run: OCI_BUILD_OPTS="--label quay.expires-after=2w" IMAGE_ORG=${{ env.WF_ORG }} VERSION=${{ env.short_sha }} PLG_VERSION=main FLP_VERSION=main BPF_VERSION=main BUNDLE_VERSION=0.0.0-${{ env.short_sha }} make bundle bundle-build
- name: push bundle to quay.io
run: IMAGE_ORG=${{ env.WF_ORG }} IMAGE=${{ env.WF_REGISTRY }}/${{ env.WF_IMAGE }}-bundle:v0.0.0-${{ env.short_sha }} make bundle-push
run: IMAGE_ORG=${{ env.WF_ORG }} VERSION=${{ env.short_sha }} BUNDLE_VERSION=0.0.0-${{ env.short_sha }} make bundle-push
- name: build catalog
run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=0.0.0-${{ env.short_sha }} make shortlived-catalog-build
- name: push catalog to quay.io
run: IMAGE_ORG=${{ env.WF_ORG }} IMAGE=${{ env.WF_REGISTRY }}/${{ env.WF_IMAGE }}-catalog:v0.0.0-${{ env.short_sha }} make catalog-push
run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=0.0.0-${{ env.short_sha }} make catalog-push
- uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
Expand Down
18 changes: 4 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,10 @@ jobs:
run: |
IMAGE_ORG=${{ env.WF_ORG }} IMAGE=${{ env.WF_REGISTRY }}/${{ env.WF_IMAGE }}:${{ env.tag }} make manifest-build manifest-push
- name: build bundle
run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=${{ env.tag }} IMAGE_TAG_BASE=${{ env.WF_REGISTRY }}/${{ env.WF_IMAGE }} make bundle-build
run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=${{ env.tag }} make bundle-build
- name: push bundle to quay.io
id: push-bundle
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.WF_IMAGE }}-bundle
tags: v${{ env.tag }}
registry: ${{ env.WF_REGISTRY }}
run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=${{ env.tag }} make bundle-push
- name: build catalog
run: BUNDLE_VERSION=${{ env.tag }} IMAGE_TAG_BASE=${{ env.WF_REGISTRY }}/${{ env.WF_IMAGE }} make catalog-build
run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=${{ env.tag }} make catalog-build
- name: push catalog to quay.io
id: push-catalog
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.WF_IMAGE }}-catalog
tags: v${{ env.tag }}
registry: ${{ env.WF_REGISTRY }}
run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=${{ env.tag }} make catalog-push
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,12 @@ update-bundle: bundle ## Prepare a clean bundle to be commited
bundle-build: ## Build the bundle image.
cp ./bundle/manifests/netobserv-operator.clusterserviceversion.yaml tmp-bundle
$(SED) -i -r 's~:created-at:~$(DATE)~' ./bundle/manifests/netobserv-operator.clusterserviceversion.yaml
-$(OCI_BIN) build -f bundle.Dockerfile -t $(BUNDLE_IMAGE) .
-$(OCI_BIN) build $(OCI_BUILD_OPTS) -f bundle.Dockerfile -t $(BUNDLE_IMAGE) .
mv tmp-bundle ./bundle/manifests/netobserv-operator.clusterserviceversion.yaml

shortlived-bundle-build: ## Build a temporary bundle image, expiring after 2 weeks on quay
$(MAKE) bundle-build BUNDLE_IMAGE=$(IMAGE_TAG_BASE)-bundle:tmp
$(OCI_BIN) build --build-arg BASE_IMAGE=$(IMAGE_TAG_BASE)-bundle:tmp -t $(BUNDLE_IMAGE) -f ./shortlived.Dockerfile .

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
$(MAKE) image-push IMAGE=$(BUNDLE_IMAGE)
$(OCI_BIN) push ${BUNDLE_IMAGE};

# A comma-separated list of bundle images (e.g. make catalog-build BUNDLE_IMAGES=example.com/operator-bundle:v0.1.0,example.com/operator-bundle:v0.2.0).
# These images MUST exist in a registry and be pull-able.
Expand All @@ -410,13 +406,13 @@ catalog-build: opm ## Build a catalog image.
$(OPM) index add --container-tool ${OCI_BIN} --mode semver --tag $(CATALOG_IMAGE) --bundles $(BUNDLE_IMAGES) $(FROM_INDEX_OPT) $(OPM_OPTS)

shortlived-catalog-build: ## Build a temporary catalog image, expiring after 2 weeks on quay
$(MAKE) catalog-build CATALOG_IMAGE=$(IMAGE_TAG_BASE)-catalog:tmp
$(OCI_BIN) build --build-arg BASE_IMAGE=$(IMAGE_TAG_BASE)-catalog:tmp -t $(CATALOG_IMAGE) -f ./shortlived.Dockerfile .
$(MAKE) catalog-build CATALOG_IMAGE=temp-catalog
echo "FROM temp-catalog" | $(OCI_BIN) build --label quay.expires-after=2w -t $(CATALOG_IMAGE) -

# Push the catalog image.
.PHONY: catalog-push
catalog-push: ## Push a catalog image.
$(MAKE) image-push IMAGE=$(CATALOG_IMAGE)
$(OCI_BIN) push ${CATALOG_IMAGE};

# Deploy the catalog.
.PHONY: catalog-deploy
Expand Down
3 changes: 0 additions & 3 deletions shortlived.Dockerfile

This file was deleted.

0 comments on commit 0598c1b

Please sign in to comment.