Skip to content

Commit 15077ba

Browse files
authored
ci(release): restrict OperatorHub PR to stable releases and add replaces field (cloudnative-pg#10291)
The operatorhub_pr job ran whenever olm-bundle succeeded, which included RC releases. Gate the job on `is_stable` from check-version to prevent RC releases from creating OperatorHub PRs. Additionally, the generated CSV was missing the `replaces` field required by the community-operators `replaces-mode` update graph, which caused the catalog build to fail. Automatically inject the `replaces` field pointing to the previous version found in the community-operators repository. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
1 parent 5023168 commit 15077ba

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/release-publish.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,14 @@ jobs:
405405
name: Create remote PR for OperatorHub
406406
runs-on: ubuntu-24.04
407407
needs:
408+
- check-version
408409
- release-binaries
409410
- olm-bundle
410411
if: |
411412
(always() && !cancelled()) &&
412-
needs.olm-bundle.result == 'success'
413+
needs.olm-bundle.result == 'success' &&
414+
needs.check-version.outputs.is_latest == 'true' &&
415+
needs.check-version.outputs.is_stable == 'true'
413416
env:
414417
VERSION: ${{ needs.release-binaries.outputs.version }}
415418
steps:
@@ -431,6 +434,12 @@ jobs:
431434
cp -R bundle/* "operators/cloudnative-pg/${VERSION}"
432435
rm -fr cloudnative-pg-catalog.yaml bundle.Dockerfile *.zip bundle/
433436
437+
- name: Add replaces field to CSV
438+
run: |
439+
CSV_FILE="operators/cloudnative-pg/${VERSION}/manifests/cloudnative-pg.clusterserviceversion.yaml"
440+
PREVIOUS_VERSION=$(ls -d operators/cloudnative-pg/[0-9]* | sort -V | tail -2 | head -1 | xargs basename)
441+
sed -i "s/^ name: cloudnative-pg\.v${VERSION}/ replaces: cloudnative-pg.v${PREVIOUS_VERSION}\n name: cloudnative-pg.v${VERSION}/" "${CSV_FILE}"
442+
434443
- name: Create Remote Pull Request
435444
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8
436445
with:

0 commit comments

Comments
 (0)