Check image availability in registries #431
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: Check image availability in registries | |
| on: # yamllint disable-line rule:truthy | |
| schedule: | |
| - cron: '30 */6 * * *' # Every 6 hours at :30 | |
| workflow_dispatch: | |
| jobs: | |
| check-odh-images: | |
| runs-on: ubuntu-26.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Install skopeo | |
| uses: ./.github/actions/apt-install | |
| with: | |
| packages: skopeo | |
| update: 'false' | |
| - name: Setup uv and Python | |
| uses: ./.github/actions/setup-uv | |
| - name: Check ODH image availability | |
| id: check | |
| run: | | |
| uv run python ci/check-image-availability.py \ | |
| manifests/odh/base/params-latest.env \ | |
| manifests/odh/base/params.env | |
| notify-on-failure: | |
| runs-on: ubuntu-26.04 | |
| needs: check-odh-images | |
| if: failure() | |
| permissions: | |
| issues: write | |
| steps: | |
| - name: Create or update GitHub issue | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| # language=javascript | |
| script: | | |
| const label = 'image-availability'; | |
| const title = '[Alert] Container image(s) not found in registry'; | |
| // Check for existing open issue | |
| const { data: issues } = await github.rest.issues.listForRepo({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| labels: label, | |
| state: 'open', | |
| }); | |
| const body = [ | |
| '## Image Availability Check Failed', | |
| '', | |
| 'One or more images referenced in `params-latest.env` or `params.env` were not found in their container registries.', | |
| '', | |
| 'This likely means a Konflux build pipeline has failed or an image tag no longer exists.', | |
| '', | |
| `**Workflow run:** ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, | |
| '', | |
| 'Please investigate and update the params files if needed.', | |
| ].join('\n'); | |
| if (issues.length > 0) { | |
| // Add comment to existing issue | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issues[0].number, | |
| body: body, | |
| }); | |
| core.info(`Added comment to existing issue #${issues[0].number}`); | |
| } else { | |
| // Create new issue | |
| const { data: issue } = await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: title, | |
| body: body, | |
| labels: [label], | |
| }); | |
| core.info(`Created new issue #${issue.number}`); | |
| } |