Conversation
Signed-off-by: oliver könig <okoenig@nvidia.com>
📝 WalkthroughWalkthroughGitHub Actions workflows are updated by removing environment specifications from several job definitions and reconfiguring PyPI authentication credentials. TWINE_USERNAME is set to a static "token" value, and TWINE_PASSWORD uses branch-aware conditional logic to select between production and test PyPI tokens. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/cicd-main.yml (1)
226-298: Ensure previously environment-scoped secrets are promoted to repo/org level.Removing
environment: nemo-cifromcicd-doc-tests,cicd-unit-tests, andcicd-functional-tests, andenvironment: mainfromnotify-nightly-failuremeans GitHub Actions will no longer resolve environment-scoped secrets for these jobs.HF_TOKEN(used incicd-unit-testsandcicd-functional-tests) andSLACK_TEAM_CHANNEL_WEBHOOK(used innotify-nightly-failure) must be present as repository-level or organization-level secrets, otherwise those steps will silently receive an empty string.Additionally, if the
nemo-ciormainenvironments had protection rules configured (required reviewers, deployment branch policies, wait timers), those controls are now bypassed for these jobs. Confirm this is acceptable before merging.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/cicd-main.yml around lines 226 - 298, The jobs cicd-doc-tests, cicd-unit-tests, cicd-functional-tests and notify-nightly-failure no longer reference environment: nemo-ci/main so environment-scoped secrets and protection rules will not be applied; ensure HF_TOKEN and SLACK_TEAM_CHANNEL_WEBHOOK are created at repository or organization secret scope (and update any other environment-scoped secrets referenced by these jobs), and verify that removing environment: nemo-ci/main does not bypass required environment protections (review required reviewers, branch/deployment policies, and wait timers) before merging; update documentation or CI setup notes to record the promotion of secrets and the acceptance of lost environment protections if intentional.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/release.yaml:
- Line 51: The TWINE_PASSWORD expression in release.yaml uses the &&/|| pattern
which silently falls back to SVC_PYPI_TEST_TOKEN if SVC_PYPI_TOKEN is empty;
change the workflow to ensure a non-empty production token is selected by either
adding a pre-publish assertion step that fails when SVC_PYPI_TOKEN is
unset/empty (check secrets.SVC_PYPI_TOKEN and fail the job) or replace the
expression with the fromJSON array-index ternary pattern so TWINE_PASSWORD
deterministically picks secrets.SVC_PYPI_TOKEN for refs/heads/main or release
branches and only uses secrets.SVC_PYPI_TEST_TOKEN for non-release refs,
referencing the TWINE_PASSWORD variable and the SVC_PYPI_TOKEN /
SVC_PYPI_TEST_TOKEN secret names when making the change.
---
Nitpick comments:
In @.github/workflows/cicd-main.yml:
- Around line 226-298: The jobs cicd-doc-tests, cicd-unit-tests,
cicd-functional-tests and notify-nightly-failure no longer reference
environment: nemo-ci/main so environment-scoped secrets and protection rules
will not be applied; ensure HF_TOKEN and SLACK_TEAM_CHANNEL_WEBHOOK are created
at repository or organization secret scope (and update any other
environment-scoped secrets referenced by these jobs), and verify that removing
environment: nemo-ci/main does not bypass required environment protections
(review required reviewers, branch/deployment policies, and wait timers) before
merging; update documentation or CI setup notes to record the promotion of
secrets and the acceptance of lost environment protections if intentional.
| TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | ||
| TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | ||
| TWINE_USERNAME: __token__ | ||
| TWINE_PASSWORD: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/r')) && secrets.SVC_PYPI_TOKEN || secrets.SVC_PYPI_TEST_TOKEN }} |
There was a problem hiding this comment.
Silent SVC_PYPI_TEST_TOKEN fallback if SVC_PYPI_TOKEN is empty.
A known limitation of the &&/|| ternary pattern is that the value after && must not be falsy; otherwise, the || branch is taken incorrectly. In GitHub Actions, falsy values include false, 0, -0, "", '', and null — which covers an unset or empty secret.
If SVC_PYPI_TOKEN is ever missing or accidentally revoked, the expression on main/release branches silently resolves to SVC_PYPI_TEST_TOKEN and the release is published to TestPyPI instead of production PyPI — with no error or warning. Since dry-run can be false in this workflow, this is a real risk.
Consider asserting the secret is non-empty in a pre-publish step, or using fromJSON indexing to avoid the silent fallback:
💡 Alternative ternary pattern that avoids the silent fallback
- TWINE_PASSWORD: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/r')) && secrets.SVC_PYPI_TOKEN || secrets.SVC_PYPI_TEST_TOKEN }}
+ TWINE_PASSWORD: ${{ fromJSON(format('["{0}","{1}"]', secrets.SVC_PYPI_TEST_TOKEN, secrets.SVC_PYPI_TOKEN))[github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/r')] }}The fromJSON array-index approach uses true→1 / false→0 coercion, so it unconditionally selects the correct token without the "falsy middle operand" pitfall.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/release.yaml at line 51, The TWINE_PASSWORD expression in
release.yaml uses the &&/|| pattern which silently falls back to
SVC_PYPI_TEST_TOKEN if SVC_PYPI_TOKEN is empty; change the workflow to ensure a
non-empty production token is selected by either adding a pre-publish assertion
step that fails when SVC_PYPI_TOKEN is unset/empty (check secrets.SVC_PYPI_TOKEN
and fail the job) or replace the expression with the fromJSON array-index
ternary pattern so TWINE_PASSWORD deterministically picks secrets.SVC_PYPI_TOKEN
for refs/heads/main or release branches and only uses
secrets.SVC_PYPI_TEST_TOKEN for non-release refs, referencing the TWINE_PASSWORD
variable and the SVC_PYPI_TOKEN / SVC_PYPI_TEST_TOKEN secret names when making
the change.
What does this PR do ?
This simplifies secrets management, and avoid polluting the PR history with deployment updates.
Issues
List issues that this PR closes (syntax):
Usage
# Add a code snippet demonstrating how to use thisBefore your PR is "Ready for review"
Pre checks:
Additional Information
Summary by CodeRabbit