|
36 | 36 | cloner-app-id: ${{ secrets.CLONER_APP_ID }} |
37 | 37 | cloner-app-private-key: ${{ secrets.CLONER_APP_PRIVATE_KEY }} |
38 | 38 | slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 39 | + |
| 40 | + # Bump the prometheus-operator jsonnet branch pin in CMO so that CRD schemas |
| 41 | + # and other generated assets stay in sync with the upstream release. |
| 42 | + check-prometheus-operator-jsonnet-pin: |
| 43 | + needs: prometheus-operator-merge |
| 44 | + # Run even if the merge job fails (e.g. due to conflicts). |
| 45 | + if: always() && needs.prometheus-operator-merge.outputs.upstream-release != '' |
| 46 | + runs-on: ubuntu-latest |
| 47 | + outputs: |
| 48 | + release-branch: ${{ steps.resolve.outputs.release-branch }} |
| 49 | + should-update: ${{ steps.resolve.outputs.should-update }} |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v7 |
| 52 | + with: |
| 53 | + repository: openshift/cluster-monitoring-operator |
| 54 | + ref: main |
| 55 | + sparse-checkout: jsonnet/jsonnetfile.json |
| 56 | + - name: Resolve release branch from upstream tag |
| 57 | + id: resolve |
| 58 | + env: |
| 59 | + UPSTREAM_TAG: ${{ needs.prometheus-operator-merge.outputs.upstream-release }} |
| 60 | + run: | |
| 61 | + # v0.92.0 -> release-0.92 |
| 62 | + RELEASE_BRANCH="release-${UPSTREAM_TAG#v}" && RELEASE_BRANCH="${RELEASE_BRANCH%.*}" |
| 63 | +
|
| 64 | + CURRENT=$(jq -r --arg remote "https://github.com/prometheus-operator/prometheus-operator" \ |
| 65 | + '(.dependencies[] | select(.source.git.remote == $remote)).version' \ |
| 66 | + jsonnet/jsonnetfile.json) |
| 67 | +
|
| 68 | + echo "latest: $RELEASE_BRANCH, current: $CURRENT" |
| 69 | + echo "release-branch=$RELEASE_BRANCH" >> "$GITHUB_OUTPUT" |
| 70 | +
|
| 71 | + if [ "$CURRENT" = "$RELEASE_BRANCH" ]; then |
| 72 | + echo "should-update=false" >> "$GITHUB_OUTPUT" |
| 73 | + else |
| 74 | + echo "should-update=true" >> "$GITHUB_OUTPUT" |
| 75 | + fi |
| 76 | +
|
| 77 | + bump-prometheus-operator-jsonnet: |
| 78 | + needs: check-prometheus-operator-jsonnet-pin |
| 79 | + # Skip if already pinned to the same release branch; another workflow handles updates within the same pin. |
| 80 | + if: needs.check-prometheus-operator-jsonnet-pin.outputs.should-update == 'true' |
| 81 | + uses: ./.github/workflows/cmo-make-targets.yaml |
| 82 | + with: |
| 83 | + pre-run: | |
| 84 | + REMOTE="https://github.com/prometheus-operator/prometheus-operator" |
| 85 | + BRANCH="${{ needs.check-prometheus-operator-jsonnet-pin.outputs.release-branch }}" |
| 86 | +
|
| 87 | + jq --arg remote "$REMOTE" --arg branch "$BRANCH" \ |
| 88 | + '(.dependencies[] | select(.source.git.remote == $remote)).version = $branch' \ |
| 89 | + jsonnet/jsonnetfile.json > jsonnet/jsonnetfile.json.tmp |
| 90 | +
|
| 91 | + mv jsonnet/jsonnetfile.json.tmp jsonnet/jsonnetfile.json |
| 92 | + make-targets: update COMPONENTS=https://github.com/prometheus-operator/prometheus-operator/jsonnet/prometheus-operator generate |
| 93 | + pr-title: "[bot] Bump prometheus-operator jsonnet release branch to ${{ needs.check-prometheus-operator-jsonnet-pin.outputs.release-branch }}" |
| 94 | + pr-body: | |
| 95 | + ## Description |
| 96 | + Updates the prometheus-operator jsonnet branch pin in |
| 97 | + [`jsonnet/jsonnetfile.json`](https://github.com/openshift/cluster-monitoring-operator/blob/main/jsonnet/jsonnetfile.json) |
| 98 | + to match the latest upstream release, and regenerates all |
| 99 | + assets including prometheus-operator CRDs YAMLs. |
| 100 | +
|
| 101 | + Note: the [downstream openshift/prometheus-operator](https://github.com/openshift/prometheus-operator/blob/main/VERSION) |
| 102 | + may still be on an older version. |
| 103 | + That is not necessarily a blocker for this PR. |
| 104 | + secrets: |
| 105 | + pr-app-id: ${{ secrets.APP_ID }} |
| 106 | + pr-app-private-key: ${{ secrets.APP_PRIVATE_KEY }} |
| 107 | + cloner-app-id: ${{ secrets.CLONER_APP_ID }} |
| 108 | + cloner-app-private-key: ${{ secrets.CLONER_APP_PRIVATE_KEY }} |
| 109 | + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} |
0 commit comments