-
Notifications
You must be signed in to change notification settings - Fork 45
chore(ci): automated renovate readiness action checks #1465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
159f6d5
feat: add renovate readiness action
mjnagel f3e6619
fix: label diffing, yamllint, renovate sorting
mjnagel 29b764b
fix: codespell ignore
mjnagel 535a0b8
chore: license fixes
mjnagel 146a335
fix: action paths
mjnagel 7a144c2
ci: [skip ci]
mjnagel 5b34c7e
fix: codeql scan [ci skip]
mjnagel aa08741
fix: helm-only updates, workflow for testing, docs
mjnagel fced6e3
Merge branch 'main' into renovate-readiness-checks
mjnagel 4f28463
Merge branch 'main' into renovate-readiness-checks
mjnagel 4fb8df5
chore: cleanup logs and bad code
mjnagel f3bcaa9
Merge branch 'main' into renovate-readiness-checks
mjnagel a341e4b
Merge branch 'main' into renovate-readiness-checks
mjnagel a01cfe6
fix: codeql issue with permissions
mjnagel 246a21d
Merge branch 'main' into renovate-readiness-checks
mjnagel 425d822
chore: pr feedback
mjnagel 694a136
chore: shim for scripts changes
mjnagel 7d4d8d5
Merge branch 'main' into renovate-readiness-checks
mjnagel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # Lint Codespell configurations | ||
| [codespell] | ||
| skip = .codespellrc,.git,node_modules,build,dist,*.zst,CHANGELOG.md,.playwright,.terraform,*.svg,**/pepr/operator/crd/generated/*.ts,**/uds-docs/** | ||
| skip = .codespellrc,.git,node_modules,build,dist,*.zst,CHANGELOG.md,.playwright,.terraform,*.svg,**/pepr/operator/crd/generated/*.ts,**/uds-docs/**,**/package-lock.json | ||
| ignore-words-list = NotIn,AKS,LICENS,aks,afterAll | ||
| enable-colors = | ||
| check-hidden = |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| "jest.*.js", | ||
| "test/playwright/", | ||
| "test/jest/", | ||
| "scripts/", | ||
| "uds-docs/" | ||
| ], | ||
| "root": true, | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # Renovate Readiness Action | ||
|
|
||
| This GitHub Action automates the process of checking if Renovate PRs are ready for testing. | ||
|
|
||
| ## Overview | ||
|
|
||
| UDS Core uses [Renovate](https://github.com/renovatebot/renovate) to track and automate dependency updates. Due to support for 3 flavors of core (upstream, registry1, and unicorn), most dependency updates are not ready when the PRs are first opened. This action automates the process of checking if a PR is ready for testing. | ||
|
|
||
| ## How It Works | ||
|
|
||
| The action performs the following steps: | ||
|
|
||
| 1. **Manual Override Check**: If the PR has the `renovate-ready` label, the action will set `should_process` to `false` and skip all other checks, allowing CI to proceed. | ||
|
|
||
| 2. **Branch Name Processing**: The action extracts the package name from the branch name by removing the `renovate/` prefix. | ||
|
|
||
| 3. **Special Case Handling**: | ||
| - **Pepr Updates**: For Pepr updates, the action compares the version in `package.json` with the image versions in `tasks/create.yaml`. If they don't match, it adds the `waiting on ironbank` label. | ||
| - **Support Dependencies**: For support dependency updates, the action adds the `needs-review` label and sets `should_process` to `false` to prevent excessive IAC runs. | ||
|
|
||
| 4. **Regular Package Updates**: | ||
| - The action performs sparse checkouts of the relevant package directory from both the PR branch and the main branch. | ||
| - It extracts images and charts from both branches using the `getImagesAndCharts.ts` script. | ||
| - It compares the extracted data using the `compareImagesAndCharts.ts` script. | ||
| - Based on the comparison, it applies appropriate labels to the PR: | ||
| - `waiting on ironbank`: If a registry1 image is behind | ||
| - `waiting on cgr`: If a chainguard image is behind | ||
| - `helm-chart-only`: If a PR only contains a helm chart update | ||
| - `needs-review`: If PR is NOT waiting on image updates | ||
| - `major-helm-update`: If the PR contains a major chart version bump | ||
| - `major-image-update`: If the PR contains a major image version bump | ||
| - If any `waiting on` labels are applied, the action sets `should_process` to `false` to prevent running CI. | ||
|
|
||
| ## Usage | ||
|
|
||
| The action is automatically triggered for all Renovate PRs in the slim-dev-test.yaml workflow. No manual intervention is required. | ||
|
|
||
| ### Manual Override | ||
|
|
||
| If you want to force a PR to run CI regardless of its readiness status, add the `renovate-ready` label to the PR. | ||
|
|
||
| ## Implementation Details | ||
|
|
||
| - **TypeScript Scripts**: The core logic for extracting and comparing images and charts is implemented in TypeScript scripts located in the `scripts/renovate` directory. | ||
| - `getImagesAndCharts.ts`: Extracts images and charts from zarf.yaml files in a directory. | ||
| - `compareImagesAndCharts.ts`: Compares extracted images and charts between two directories and determines if the PR is ready for testing. | ||
| - **GitHub Action**: The GitHub Action orchestrates the process, handling special cases and applying labels based on the script outputs. | ||
| - **Workflow Integration**: The action is integrated into the slim-dev-test.yaml workflow, which is triggered for all PRs. | ||
| - **Output Variables**: | ||
| - `should_process`: Indicates whether the PR should proceed with CI. Set to `false` if the PR has the `renovate-ready` label or if it's waiting on image updates. | ||
| - `needs_comparison`: Indicates whether the PR needs to run the comparison scripts. Set to `false` for special cases like Pepr updates. | ||
|
|
||
| ## Testing | ||
|
|
||
| The TypeScript scripts are thoroughly tested using Jest: | ||
|
|
||
| - **getImagesAndCharts.test.ts**: Tests the extraction of images and charts from zarf.yaml files, including edge cases like: | ||
| - Empty directories | ||
| - Invalid YAML files | ||
| - Missing components | ||
| - Images without version tags | ||
|
|
||
| - **compareImagesAndCharts.test.ts**: Tests the comparison of images and charts, including: | ||
| - Helm chart updates (both regular and major) | ||
| - Image updates (including major updates) | ||
| - Waiting conditions for Ironbank and Chainguard images | ||
| - Missing or empty extract files | ||
| - Invalid version formats | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| If you encounter issues with the action, check the following: | ||
|
|
||
| 1. **PR Labels**: Check if the PR has any `waiting on` labels, which indicate what the PR is waiting for. | ||
| 2. **Action Logs**: Check the action logs for any errors or warnings. | ||
| 3. **Manual Override**: If needed, add the `renovate-ready` label to force the PR to run CI. | ||
| 4. **Debug Output**: The action outputs detailed information about its decisions, which can help diagnose issues. | ||
|
|
||
| ## Related Documentation | ||
|
|
||
| - [Renovate PR Process](https://www.notion.so/Renovate-PR-Process-182e512f24fc80479d35f956a7c42388?pvs=21) | ||
| - [Renovate Documentation](https://docs.renovatebot.com/) |
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.