Skip to content

Commit 10ee1a0

Browse files
committed
fix catalog build
1 parent 41fb4d2 commit 10ee1a0

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

.github/workflows/build_image_pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
run: echo "WF_RELIMG_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
2828
- name: build and save bundle image
2929
run: OCI_BUILD_OPTS="--label quay.expires-after=2w" IMAGE_ORG=${{ env.WF_ORG }} VERSION=${{ env.short_sha }} PLG_VERSION=${{ env.WF_RELIMG_VERSION }} FLP_VERSION=${{ env.WF_RELIMG_VERSION }} BPF_VERSION=${{ env.WF_RELIMG_VERSION }} BUNDLE_VERSION=0.0.0-sha-${{ env.short_sha }} CLEAN_BUILD=1 BUNDLE_SET_DATE=true make bundle bundle-tar
30+
- name: build and save catalog image
31+
run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=0.0.0-sha-${{ env.short_sha }} CLEAN_BUILD=1 make catalog-tar
3032
- name: save PR number
3133
run: |
3234
echo ${{ github.event.number }} > ./out/pr-id

.github/workflows/push_image_pr.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,18 @@ jobs:
2626
run: |
2727
docker load --input ./operator.tar
2828
docker load --input ./bundle.tar
29+
docker load --input ./catalog.tar
2930
- name: docker login to quay.io
3031
uses: docker/login-action@v2
3132
with:
3233
username: ${{ env.WF_REGISTRY_USER }}
3334
password: ${{ secrets.QUAY_SECRET }}
3435
registry: quay.io
35-
- name: push operator and bundle
36+
- name: push operator, bundle and catalog
3637
run: |
3738
DOCKER_BUILDKIT=1 docker push $(cat ./operator-name)
3839
DOCKER_BUILDKIT=1 docker push $(cat ./bundle-name)
39-
- name: build and push catalog
40-
run: |
41-
IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=0.0.0-sha-$(cat ./short-sha) make shortlived-catalog-build catalog-push
40+
DOCKER_BUILDKIT=1 docker push $(cat ./catalog-name)
4241
- uses: actions/github-script@v6
4342
with:
4443
github-token: ${{secrets.GITHUB_TOKEN}}
@@ -48,6 +47,7 @@ jobs:
4847
var shortSha = String(fs.readFileSync('./short-sha')).trim();
4948
var operatorImage = fs.readFileSync('./operator-name');
5049
var bundleImage = fs.readFileSync('./bundle-name');
50+
var catalogImage = fs.readFileSync('./catalog-name');
5151
github.rest.issues.createComment({
5252
issue_number: issueNumber,
5353
owner: context.repo.owner,
@@ -56,7 +56,7 @@ jobs:
5656
\`\`\`bash
5757
${operatorImage}
5858
${bundleImage}
59-
quay.io/netobserv/network-observability-operator-catalog:v0.0.0-sha-${shortSha}
59+
${catalogImage}
6060
\`\`\`
6161
6262
They will expire in two weeks.
@@ -79,7 +79,7 @@ jobs:
7979
namespace: openshift-marketplace
8080
spec:
8181
sourceType: grpc
82-
image: quay.io/netobserv/network-observability-operator-catalog:v0.0.0-sha-${shortSha}
82+
image: ${catalogImage}
8383
displayName: NetObserv development catalog
8484
publisher: Me
8585
updateStrategy:

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,13 +484,9 @@ endif
484484
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
485485
.PHONY: catalog-build
486486
catalog-build: opm ## Build a catalog image.
487-
OPM=$(OPM) BUNDLE_IMAGE=$(BUNDLE_IMAGE) BUNDLE_TAG="v$(BUNDLE_VERSION)" ./hack/update_fbc.sh
487+
OPM=$(OPM) BUNDLE_TAG="v$(BUNDLE_VERSION)" ./hack/update_fbc.sh
488488
$(OCI_BIN) build $(OCI_BUILD_OPTS) --build-arg CATALOG_PATH="catalog/out/v$(BUNDLE_VERSION)" -f catalog.Dockerfile -t $(CATALOG_IMAGE) .
489489

490-
shortlived-catalog-build: ## Build a temporary catalog image, expiring after 2 weeks on quay
491-
$(MAKE) catalog-build CATALOG_IMAGE=temp-catalog
492-
echo "FROM temp-catalog" | $(OCI_BIN) build --label quay.expires-after=2w -t $(CATALOG_IMAGE) -
493-
494490
# Push the catalog image.
495491
.PHONY: catalog-push
496492
catalog-push: ## Push a catalog image.
@@ -506,6 +502,14 @@ catalog-deploy: ## Deploy a catalog image.
506502
catalog-undeploy: ## Undeploy a catalog image.
507503
kubectl delete -f ./config/samples/catalog/catalog.yaml
508504

505+
.PHONY: catalog-tar
506+
catalog-tar: ## Build catalog image and save as a tar
507+
mkdir -p ./out
508+
$(MAKE) catalog-build CATALOG_IMAGE=temp-catalog
509+
echo "FROM temp-catalog" | $(OCI_BIN) build --label quay.expires-after=2w -t $(CATALOG_IMAGE) -
510+
$(OCI_BIN) save -o out/catalog.tar $(CATALOG_IMAGE)
511+
echo $(CATALOG_IMAGE) > ./out/catalog-name
512+
509513
##@ Misc
510514

511515
.PHONY: test-workflow

hack/update_fbc.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if [ -z "${YQ}" ]; then
2323
exit 1
2424
fi
2525

26-
echo "Creating new bundle using image ${BUNDLE_IMAGE}..."
26+
echo "Creating new catalog..."
2727

2828
dir_catalog="catalog/out/${BUNDLE_TAG}"
2929
dir_catalog_legacy="catalog/out-legacy/${BUNDLE_TAG}"
@@ -32,8 +32,8 @@ mkdir -p "${dir_catalog_legacy}"
3232
cp -f catalog/parts/other.yaml ${dir_catalog}
3333
cp -f catalog/parts/other.yaml ${dir_catalog_legacy}
3434

35-
${OPM} render "${BUNDLE_IMAGE}" --output=yaml --migrate-level=bundle-object-to-csv-metadata > "${dir_catalog}/bundle.yaml"
36-
${OPM} render "${BUNDLE_IMAGE}" --output=yaml > "${dir_catalog_legacy}/bundle.yaml"
35+
${OPM} render ./bundle --output=yaml --migrate-level=bundle-object-to-csv-metadata > "${dir_catalog}/bundle.yaml"
36+
${OPM} render ./bundle --output=yaml > "${dir_catalog_legacy}/bundle.yaml"
3737

3838
echo "Generating single index..."
3939
cat <<EOF > "${dir_catalog}/index.yaml"

0 commit comments

Comments
 (0)