-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chore: Adds version scanner CI/CD upgrades #17425
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
base: main
Are you sure you want to change the base?
Changes from all commits
0952729
163b773
3fd95aa
632e3da
6b844c6
f679fd7
2356936
7b8f3c3
dc6b011
f357200
ae291ad
8b64db7
265ba67
e1c6391
4f67a1a
fe5c56a
cc8cd2d
a002eb1
e6fe5f6
ed30dab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| name: Version Scan | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - '**version-scanner**' | ||
| schedule: | ||
| - cron: '0 * * * *' # Run hourly at the top of the hour | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| issues: write | ||
|
|
||
| jobs: | ||
| scan: | ||
| name: Version Scan | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.14' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install pyyaml | ||
|
|
||
| - name: Run Version Scanner | ||
| run: | | ||
| # Uses -o to output a detailed, raw CSV to a file | ||
| # Uses --stdout to print a slim, easier to parse summary to the GitHub Actions UI | ||
| # Uses --soft-fail to temporarily limit causing CI/CD failures during the migration to full operation. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the plan to resolve/ignore the current alerts, and then remove --soft-fail?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding long term plans: Q2: This is a prototype implementation. The OG version_scanner only accepts one dependency and one version at a time. The implementation plan is to update it so that you can provide a list of runtimes OR dependencies and pair them with a list of versions: i.e. Whatever is needed/whatever the most recent deprecations may be. Q3: Yes, the plan is to mitigate any existing issues during this migration phase and then disable the |
||
| python scripts/version_scanner/version_scanner.py -d python -v 3.7 --stdout -o version_scanner_output.csv --soft-fail | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw in the output, it is looking for 3.7. Is this where that is configured? Can that be an envvar/argument? Why search for just 3.7 specifically? Should we be checking for all outdated versions? |
||
|
|
||
| - name: Upload CSV Results | ||
| if: always() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: version-scanner-results | ||
| path: version_scanner_output.csv | ||
|
|
||
| - name: Create or update issue on finding | ||
| if: failure() | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| TITLE="Version Scanner found deprecated dependencies" | ||
| RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
|
|
||
| # Read the first 50 lines to prevent blowing up the issue body if it's massive | ||
| CSV_PREVIEW=$(head -n 50 version_scanner_output.csv) | ||
|
|
||
| BODY="The [Version Scanner]($RUN_URL) found deprecated dependencies in the repository. | ||
|
|
||
| **Matches Found:** | ||
| \`\`\`csv | ||
| $CSV_PREVIEW | ||
| \`\`\` | ||
| *(If there are more than 50 matches, see the workflow logs for the full list)*" | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following is a prototype of enabling the creation of an issue if/when future regressions are found, since the scans are intended to be run nightly OR as a post-submit (exact cadence is TBD during a later phase of the project). |
||
| # Mirroring regenerate-all.yml: check if an issue already exists to prevent spam | ||
| EXISTING_ISSUE=$(gh issue list --state open --search "in:title \"$TITLE\"" --json number --jq '.[0].number') | ||
|
|
||
| if [ -z "$EXISTING_ISSUE" ]; then | ||
| echo "WOULD HAVE CREATED ISSUE:" | ||
| echo "gh issue create --title \"$TITLE\" --body \"$BODY\"" | ||
| # gh issue create --title "$TITLE" --body "$BODY" | ||
| else | ||
| echo "Issue #$EXISTING_ISSUE already exists." | ||
| echo "WOULD HAVE ADDED COMMENT:" | ||
| echo "gh issue comment \"$EXISTING_ISSUE\" --body \"Another scanner run found deprecated dependencies: $RUN_URL\"" | ||
| # gh issue comment "$EXISTING_ISSUE" --body "Another scanner run found deprecated dependencies: $RUN_URL" | ||
| fi | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently set to run hourly (which will take effect once it gets merged to
main) to help facilitate the development cycle for some upcoming features. Once development is done, we can set this to an appropriate cadence.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you expect to use long term? Does it make sense to run both on a schedule, and on each commit?