From 9954e07cb742bc340cb853db37a47ceabb4d605e Mon Sep 17 00:00:00 2001 From: Feruzjon Muyassarov Date: Mon, 13 Jan 2025 14:44:38 +0200 Subject: [PATCH] OLM test Signed-off-by: Feruzjon Muyassarov --- .github/workflows/publish-olm-bundle.yaml | 66 +++++++++++++++++++++++ deployment/operator/Makefile | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish-olm-bundle.yaml diff --git a/.github/workflows/publish-olm-bundle.yaml b/.github/workflows/publish-olm-bundle.yaml new file mode 100644 index 000000000..264d3c853 --- /dev/null +++ b/.github/workflows/publish-olm-bundle.yaml @@ -0,0 +1,66 @@ +name: Submit release OLM bundle + +# on: +# release: +# types: +# - published +on: + push: + tags: + - v0.** + +jobs: + createPullRequest: + name: Publish new OperatorHub release + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Build the bundle + run: pushd deployment/operator && make bundle && popd + + - name: Checkout upstream community-operators repo + uses: actions/checkout@v4 + with: + repository: k8s-operatorhub/community-operators + path: community-operators + ref: main + token: ${{ secrets.BOT_PAT }} + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + id: import-gpg + with: + gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.BOT_PASSPHRASE }} + git_user_signingkey: true + git_commit_gpgsign: true + workdir: community-operators + + - name: Copy the bundle to the community-operators repo + run: | + mkdir -p community-operators/operators/nri-plugins-operator/${{ github.ref_name }} + cp -r deployment/operator/bundle/ community-operators/operators/nri-plugins-operator/${{ github.ref_name }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + signoff: true + author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> + draft: true + add-paths: | + operators/nri-plugins-operator/** + committer: "Github Actions <${{ steps.import-gpg.outputs.email }}>" + path: community-operators + push-to-fork: nri-plugins-bot/community-operators + branch: olm-${{ github.ref_name }} + token: ${{ secrets.BOT_PAT }} + delete-branch: false + title: 'nri-plugins-operator ${{ github.ref_name }}' + commit-message: 'Submit operator nri-plugins-operator ${{ github.ref_name }}' + body: | + Added OLM bundle for [nri-plugins operator ${{ github.ref_name }}](https://github.com/containers/nri-plugins/releases/tag/${{ github.ref_name }}) + > Auto-generated by `Github Actions Bot` diff --git a/deployment/operator/Makefile b/deployment/operator/Makefile index 549d1a45b..c5345e7d9 100644 --- a/deployment/operator/Makefile +++ b/deployment/operator/Makefile @@ -94,7 +94,7 @@ endif .PHONY: bundle bundle: copy-crds kustomize operator-sdk kustomizations ## Generate bundle manifests and metadata, then validate generated files. - $(OPERATOR_SDK) generate kustomize manifests -q + # $(OPERATOR_SDK) generate kustomize manifests -q cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMAGE) find config/manifests/bases -name nri-plugins-operator.clusterserviceversion.yaml | xargs -I '{}' \ sed -e "s|containerImage:.*|containerImage: $(IMAGE)|" -i '{}';