diff --git a/.github/workflows/build_image_pr.yml b/.github/workflows/build_image_pr.yml index c1e124585..9203b8ec1 100644 --- a/.github/workflows/build_image_pr.yml +++ b/.github/workflows/build_image_pr.yml @@ -27,6 +27,8 @@ jobs: run: echo "WF_RELIMG_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV - name: build and save bundle image 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 + - name: build and save catalog image + run: IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=0.0.0-sha-${{ env.short_sha }} CLEAN_BUILD=1 make catalog-tar - name: save PR number run: | echo ${{ github.event.number }} > ./out/pr-id diff --git a/.github/workflows/push_image_pr.yml b/.github/workflows/push_image_pr.yml index d6ee3ea52..1f4afcb44 100644 --- a/.github/workflows/push_image_pr.yml +++ b/.github/workflows/push_image_pr.yml @@ -26,19 +26,18 @@ jobs: run: | docker load --input ./operator.tar docker load --input ./bundle.tar + docker load --input ./catalog.tar - name: docker login to quay.io uses: docker/login-action@v2 with: username: ${{ env.WF_REGISTRY_USER }} password: ${{ secrets.QUAY_SECRET }} registry: quay.io - - name: push operator and bundle + - name: push operator, bundle and catalog run: | DOCKER_BUILDKIT=1 docker push $(cat ./operator-name) DOCKER_BUILDKIT=1 docker push $(cat ./bundle-name) - - name: build and push catalog - run: | - IMAGE_ORG=${{ env.WF_ORG }} BUNDLE_VERSION=0.0.0-sha-$(cat ./short-sha) make shortlived-catalog-build catalog-push + DOCKER_BUILDKIT=1 docker push $(cat ./catalog-name) - uses: actions/github-script@v6 with: github-token: ${{secrets.GITHUB_TOKEN}} @@ -48,6 +47,7 @@ jobs: var shortSha = String(fs.readFileSync('./short-sha')).trim(); var operatorImage = fs.readFileSync('./operator-name'); var bundleImage = fs.readFileSync('./bundle-name'); + var catalogImage = fs.readFileSync('./catalog-name'); github.rest.issues.createComment({ issue_number: issueNumber, owner: context.repo.owner, @@ -56,7 +56,7 @@ jobs: \`\`\`bash ${operatorImage} ${bundleImage} - quay.io/netobserv/network-observability-operator-catalog:v0.0.0-sha-${shortSha} + ${catalogImage} \`\`\` They will expire in two weeks. @@ -79,7 +79,7 @@ jobs: namespace: openshift-marketplace spec: sourceType: grpc - image: quay.io/netobserv/network-observability-operator-catalog:v0.0.0-sha-${shortSha} + image: ${catalogImage} displayName: NetObserv development catalog publisher: Me updateStrategy: diff --git a/Makefile b/Makefile index d7809aef1..b0abf91c3 100644 --- a/Makefile +++ b/Makefile @@ -484,13 +484,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=$(OPM) BUNDLE_IMAGE=$(BUNDLE_IMAGE) BUNDLE_TAG="v$(BUNDLE_VERSION)" ./hack/update_fbc.sh + OPM=$(OPM) BUNDLE_TAG="v$(BUNDLE_VERSION)" ./hack/update_fbc.sh $(OCI_BIN) build $(OCI_BUILD_OPTS) --build-arg CATALOG_PATH="catalog/out/v$(BUNDLE_VERSION)" -f catalog.Dockerfile -t $(CATALOG_IMAGE) . -shortlived-catalog-build: ## Build a temporary catalog image, expiring after 2 weeks on quay - $(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. @@ -506,6 +502,14 @@ catalog-deploy: ## Deploy a catalog image. catalog-undeploy: ## Undeploy a catalog image. kubectl delete -f ./config/samples/catalog/catalog.yaml +.PHONY: catalog-tar +catalog-tar: ## Build catalog image and save as a tar + mkdir -p ./out + $(MAKE) catalog-build CATALOG_IMAGE=temp-catalog + echo "FROM temp-catalog" | $(OCI_BIN) build --label quay.expires-after=2w -t $(CATALOG_IMAGE) - + $(OCI_BIN) save -o out/catalog.tar $(CATALOG_IMAGE) + echo $(CATALOG_IMAGE) > ./out/catalog-name + ##@ Misc .PHONY: test-workflow diff --git a/hack/update_fbc.sh b/hack/update_fbc.sh index 166ef793d..41003a9fb 100755 --- a/hack/update_fbc.sh +++ b/hack/update_fbc.sh @@ -23,7 +23,7 @@ if [ -z "${YQ}" ]; then exit 1 fi -echo "Creating new bundle using image ${BUNDLE_IMAGE}..." +echo "Creating new catalog..." dir_catalog="catalog/out/${BUNDLE_TAG}" dir_catalog_legacy="catalog/out-legacy/${BUNDLE_TAG}" @@ -32,8 +32,8 @@ mkdir -p "${dir_catalog_legacy}" cp -f catalog/parts/other.yaml ${dir_catalog} cp -f catalog/parts/other.yaml ${dir_catalog_legacy} -${OPM} render "${BUNDLE_IMAGE}" --output=yaml --migrate-level=bundle-object-to-csv-metadata > "${dir_catalog}/bundle.yaml" -${OPM} render "${BUNDLE_IMAGE}" --output=yaml > "${dir_catalog_legacy}/bundle.yaml" +${OPM} render ./bundle --output=yaml --migrate-level=bundle-object-to-csv-metadata > "${dir_catalog}/bundle.yaml" +${OPM} render ./bundle --output=yaml > "${dir_catalog_legacy}/bundle.yaml" echo "Generating single index..." cat < "${dir_catalog}/index.yaml"