Skip to content

ci(deps): auto-regenerate hash-pinned CI Python requirements in generate_all_dependencies.sh - #4613

Closed
derrickaw wants to merge 3 commits into
mainfrom
codescan/ci-auto-update-pinned-pip-hashes
Closed

derrickaw wants to merge 3 commits into
mainfrom
codescan/ci-auto-update-pinned-pip-hashes

Conversation

@derrickaw

@derrickaw derrickaw commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Note: this PR was auto-generated by tooling. Before moving it out of draft, the author has done a full review of the PR, specifically evaluating it on the following criteria:

  • The PR remediates confirmed, live Code Scanning finding(s) (CodeQL / Scorecard / zizmor) on main that are not already covered by upcoming Apache Beam releases, without altering intended template or workflow semantics
  • The fix is minimal, idiomatic, respects Dataflow Templates release-label and lockfile policies, and avoids suppressing alerts or masking defects
  • Relevant unit tests, linters, and CI checks have been verified

If you have concerns with the PR or with the underlying methodology used to generate this, please comment below - they will be addressed by the author not the tooling :)

Summary

Extends python/generate_all_dependencies.sh (invoked on every Beam release upgrade and every Monday by .github/workflows/update-python-deps.yml under Python 3.11) so the hash-pinned test and CI workflow requirements introduced in PRs #4602, #4603, #4604, #4605, and #4606 have their version pins and SHA-256 digests refreshed automatically alongside the existing chore(deps): update Python dependencies PR.

What's Included

@derrickaw derrickaw added cleanup ignore-for-release github_actions Pull requests that update GitHub Actions code labels Nov 20, 2026
@derrickaw

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds an update_if_present helper function to generate_all_dependencies.sh to regenerate hash-pinned CI workflow and test-infra requirements, and introduces a new requirements-test.in file for bigquery anomaly detection. Feedback suggests adding a check to ensure the base requirements file exists before compilation to prevent script failures.

Comment thread python/generate_all_dependencies.sh Resolved
@derrickaw

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a helper function update_if_present in generate_all_dependencies.sh to conditionally regenerate hash-pinned CI workflow and test-infra helper requirements, and adds a new test-only requirements file for the BigQuery anomaly detection module. Feedback suggests executing generate_dependencies.sh using bash instead of sh to prevent potential compatibility issues with bash-specific features.

Comment thread python/generate_all_dependencies.sh Resolved
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 37.88%. Comparing base (fb3d4bc) to head (20f116e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4613      +/-   ##
============================================
+ Coverage     33.53%   37.88%   +4.35%     
- Complexity      512      521       +9     
============================================
  Files           219      197      -22     
  Lines         13486    12001    -1485     
  Branches       1373     1228     -145     
============================================
+ Hits           4523     4547      +24     
+ Misses         8590     7080    -1510     
- Partials        373      374       +1     
Components Coverage Δ
spanner-templates ∅ <ø> (∅)
spanner-import-export ∅ <ø> (∅)
spanner-live-forward-migration ∅ <ø> (∅)
spanner-live-reverse-replication ∅ <ø> (∅)
spanner-bulk-migration ∅ <ø> (∅)
gcs-spanner-dv ∅ <ø> (∅)
see 24 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@derrickaw derrickaw added the ready-for-human Draft PR checks passed and ready for human review label Nov 20, 2026
@derrickaw

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates python/generate_all_dependencies.sh by introducing an update_if_present helper function to conditionally regenerate hash-pinned CI workflow and test-infra helper requirements. A review comment suggests executing generate_dependencies.sh using bash instead of sh to ensure compatibility and prevent potential syntax or runtime errors on systems where sh does not point to bash.

BUILD_REQ="$2"
DEST_REQ="$3"
if [ -f "$BASE_REQ" ] && [ -f "$DEST_REQ" ] && grep -q -- "--hash=" "$DEST_REQ"; then
sh "$SCRIPTPATH/generate_dependencies.sh" "$BASE_REQ" "$BUILD_REQ"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since generate_dependencies.sh specifies #!/bin/bash in its shebang and uses bash-specific features (such as alias), it should be executed using bash instead of sh to ensure portability and avoid syntax or runtime errors on systems where sh points to a non-bash shell (like dash on Ubuntu/Debian).

Suggested change
sh "$SCRIPTPATH/generate_dependencies.sh" "$BASE_REQ" "$BUILD_REQ"
bash "$SCRIPTPATH/generate_dependencies.sh" "$BASE_REQ" "$BUILD_REQ"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping sh intentionally to match lines 24–25 above: generate_dependencies.sh defines alias pip_automation="pip" without shopt -s expand_aliases, so non-interactive bash fails with pip_automation: command not found (exit 127), whereas POSIX sh (dash on Ubuntu) expands aliases in non-interactive scripts.

@derrickaw derrickaw added ready-for-human Draft PR checks passed and ready for human review and removed ready-for-human Draft PR checks passed and ready for human review labels Nov 21, 2026
@derrickaw

Copy link
Copy Markdown
Contributor Author

Closing in favor of reusing existing hash-locked requirements on main (#4602, #4603), SHA-pinned GitHub Action (#4606), and native Dependabot pip hash updates (#4604, #4605) without modifying generate_all_dependencies.sh.

@derrickaw derrickaw closed this Nov 22, 2026
@derrickaw
derrickaw deleted the codescan/ci-auto-update-pinned-pip-hashes branch November 22, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup github_actions Pull requests that update GitHub Actions code ignore-for-release ready-for-human Draft PR checks passed and ready for human review size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant