[RHIDP-12889] Update Lightspeed Deployment and Configs #4682
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Bundle Manifests Validator | |
| on: | |
| # pull_request_target needed to be able to commit and push bundle diffs to external fork PRs. | |
| # But we included a manual authorization safeguard to prevent PWN requests. See the 'authorize' job below. | |
| pull_request_target: | |
| branches: | |
| - main | |
| - rhdh-1.[0-9]+ | |
| - 1.[0-9]+.x | |
| - release-1.[0-9]+ | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| authorize: | |
| # The 'external' environment is configured with the repo maintainers team as required reviewers. | |
| # All the subsequent jobs in this workflow 'need' this job, which will require manual approval for PRs coming from external forks. | |
| # see list of approvers in OWNERS file | |
| environment: | |
| ${{ (github.event.pull_request.head.repo.full_name == github.repository || | |
| contains(fromJSON('["gazarenkov","nickboldt","rm3l","kim-tsao","kadel","Fortune-Ndlovu","subhashkhileri","zdrapela","openshift-cherrypick-robot", "OpinionatedHeron"]'), github.event.pull_request.user.login)) && 'internal' || 'external' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: approved | |
| run: echo "✓" | |
| pr-bundle-diff-checks: | |
| name: PR Bundle Diff | |
| runs-on: ubuntu-latest | |
| needs: authorize | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Clean Go module cache | |
| run: rm -rf "${GOMODCACHE:-$HOME/go/pkg/mod}" | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| fetch-depth: 0 | |
| repository: ${{github.event.pull_request.head.repo.full_name}} | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Setup Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Check for outdated bundle or manifests | |
| id: manifests-diff-checker | |
| run: | | |
| make bundles build-installers | |
| git status --porcelain | |
| # Since operator-sdk 1.26.0, `make bundle` changes the `createdAt` field from the bundle every time we run it. | |
| # The `git diff` below checks if only the createdAt field has changed. If is the only change, it is ignored. | |
| # Inspired from https://github.com/operator-framework/operator-sdk/issues/6285#issuecomment-1415350333 | |
| echo "MANIFESTS_CHANGED=$(if git diff --quiet -I'^ createdAt: ' bundle config dist; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | |
| - name: Commit and push any manifest changes | |
| if: ${{ steps.manifests-diff-checker.outputs.MANIFESTS_CHANGED == 'true' }} | |
| run: | | |
| git remote add fork "https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git" | |
| git fetch fork ${{ github.event.pull_request.head.ref }} | |
| git checkout -B pr-branch fork/${{ github.event.pull_request.head.ref }} | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add -A . | |
| git commit \ | |
| -m "Regenerate bundle/installer manifests" \ | |
| -m "Co-authored-by: $GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" | |
| git push fork pr-branch:${{ github.event.pull_request.head.ref }} | |
| - name: Comment on PR if manifests were updated | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 | |
| if: ${{ !cancelled() && steps.manifests-diff-checker.outputs.MANIFESTS_CHANGED == 'true' }} | |
| continue-on-error: true | |
| env: | |
| GH_BLOB_VIEWER_BASE_URL: ${{github.event.pull_request.head.repo.html_url}}/blob/${{github.event.pull_request.head.ref}} | |
| with: | |
| script: | | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '⚠️ <b>Files changed in bundle and installer generation!</b><br/><br/>Those changes to the operator bundle/installer manifests should have been pushed automatically to your PR branch.<br/><br/><b>NOTE: </b>If the PR checks are stuck after this additional commit, manually close the PR and immediately reopen it to trigger the checks again.' | |
| }) |