Skip to content

ci: AUT-2303 report trigger type in Slack failure alerts - #3379

Merged
ko3n1g merged 32 commits into
NVIDIA-NeMo:mainfrom
svcnemo-autobot:ci/slack-alert-trigger-field
Sep 18, 2026
Merged

ko3n1g merged 32 commits into
NVIDIA-NeMo:mainfrom
svcnemo-autobot:ci/slack-alert-trigger-field

Conversation

@svcnemo-autobot

@svcnemo-autobot svcnemo-autobot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Background

Two CI-hygiene changes for Gym:

  1. Slack failure alerts (shared FW-CI-templates send-slack-alert action) do not say how a run was triggered β€” push to main, nightly schedule, or manual dispatch.
  2. The CI scripts could not run in an offline container with dependencies baked in, because they unconditionally downloaded tooling at setup time.

What changed

  • cicd-main.yml / full-test-suite.yml: added a Trigger: bullet mapping github.event_name (schedule β†’ Nightly schedule, workflow_dispatch β†’ Manual dispatch, else Push to main).
  • scripts/ci/setup_dev.sh: reuse a present uv when it is the pinned version; in the container (NEMO_GYM_CONTAINER=1) sync --offline from the pre-populated cache.
  • scripts/ci/lint.sh: reuse a pre-commit already on PATH (offline/container); otherwise install the pinned pre-commit (version from uv.lock) into an isolated venv. No uv, no setup_dev.sh in the lint path.
  • docker/Dockerfile: sync the project venv with the dev extra (pre-commit on PATH), seed the runtime uv cache, and seed PRE_COMMIT_HOME via pre-commit install-hooks at build time so the first offline lint run needs no network.
  • tests/unit_tests/test_ci_environment.py: coverage for the Trigger label, the uv-reuse/offline gate, lint PATH-first, and the Dockerfile uv-cache + hook-cache seeding.

Details

The trigger label is an inline GitHub expression on github.event_name; the shared send-slack-alert action is unchanged. The lint path performs no uv install and runs no remote install script. The image seeds both caches the lint path needs β€” uv packages (UV_CACHE_DIR) and pre-commit hook repos + environments (PRE_COMMIT_HOME) β€” resolved while the build has network and left writable by the runtime UID.

Tested

  • bash -n passes on both scripts; git diff --check clean; static assertions confirm the Trigger label, the offline gates, lint PATH-first, and the Dockerfile seeding.
  • GitHub CI on this PR runs the full unit + lint suite and is the authoritative gate.

Add a Trigger field to the send-slack-alert message in the cicd-main and
full-test-suite notify-failure jobs, mapping github.event_name to a
friendly label: Nightly schedule, Manual dispatch, or Push to main.

Pin the line with a unit test over both notify-failure message bodies.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnemo-autobot
svcnemo-autobot requested a review from a team as a code owner September 14, 2026 20:36
@copy-pr-bot

copy-pr-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the area:ci CI workflows, test routing, and repository automation label Sep 14, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 50b8a73

The managed validation environment runs these scripts in a container that
already has all dependencies (uv 0.11.29, a pre-populated uv cache, and
pre-commit), but with no package-index egress. Previously both scripts
unconditionally downloaded tooling (setup_dev.sh curled the uv installer and
ran an online 'uv sync'; lint.sh pip-installed pre-commit), so they failed
during environment bootstrap before any test ran.

Make both scripts work in online and offline environments:
- setup_dev.sh: when uv 0.11.29 is already on PATH, skip the download and run
  'uv sync --offline' to resolve from the cache; otherwise download uv and sync
  online exactly as before.
- lint.sh: when pre-commit is already on PATH, use it directly; otherwise
  install the pinned pre-commit into the tool venv as before.

Add a unit test pinning the offline/online behavior of both scripts.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnemo-autobot svcnemo-autobot changed the title ci: AUT-2303 report trigger type in Slack failure alerts ci: AUT-2303 report trigger type in Slack failure alerts and run CI scripts offli Sep 14, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test c55daf6

The offline validation container's runtime uv cache (/opt/nemo-gym/cache/uv)
was created empty after the build syncs populated only the build cache
(/opt/uv/cache). So setup_dev.sh's 'uv sync --extra dev --offline' could not
resolve project dependencies such as ray from the runtime cache.

Seed the runtime cache during the release-stage build with the full dependency
set (project + vllm + telemetry + dev extras) in a throwaway venv, then remove
the venv and hand the cache to the runtime UID. Add a unit test pinning that the
runtime cache is seeded with the dev extra.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the area:build Packaging, dependencies, containers, and releases label Sep 14, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 5fcfeba

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test bc74e2e

@svcnvidia-nemo-ci svcnvidia-nemo-ci added complexity:low Localized change in one scope with a small, straightforward review surface and removed area:build Packaging, dependencies, containers, and releases complexity:medium Single-domain change with interacting parts or a moderate review surface labels Sep 16, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 4aa0fcc

Reinstate the offline/container hardening that the previous simplify dropped:
- docker/Dockerfile: sync the persistent project venv with the dev extra so
  pre-commit is on PATH offline, and seed the runtime uv cache so
  `uv sync --offline` resolves from cache.
- scripts/ci/lint.sh: reuse a pre-commit already on PATH (offline/container);
  otherwise provision the pinned pre-commit (version from uv.lock) into an
  isolated venv. No uv, no setup_dev.sh.
- scripts/ci/setup_dev.sh: reuse a present pinned uv (baked image) and sync
  offline in the container; the online path keeps the existing pinned-install
  mechanism unchanged.
- tests: cover the uv-reuse/offline gate, lint PATH-first, and the Dockerfile
  cache seeding.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test ac8b4b7

test_server_tests_propagates_absolute_cache_and_venv_roots wrote the fake uv
binary to ${UV_UNMANAGED_INSTALL}, which the old setup_dev.sh set inline. The
new uv-reuse gate no longer exports it, so under set -u the download branch
failed with exit 2. Install the fake uv directly into the directory setup_dev.sh
puts on PATH (${repo_root}/.cache/nemo-gym-ci/uv-0.11.29), independent of that
variable. Verified by running the real server_tests.sh against the fake curl/uv.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@ko3n1g

ko3n1g commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

/ok to test 2be7def

@ko3n1g

ko3n1g commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

/review

Copy link
Copy Markdown
Contributor Author

Re: the outstanding CHANGES_REQUESTED findings β€” both are already resolved at head 2be7def:

  1. merge_group: the PR makes no merge_group change. cicd-main.yml and code-linting.yml both still carry merge_group: types: [checks_requested]; the only cicd-main.yml delta is the added β€’ Trigger: bullet in the Slack alert.
  2. offline lint / dev environment: the offline path is intact β€” docker/Dockerfile syncs the persistent project venv with the dev extra (pre-commit on PATH) and seeds the runtime uv cache, and scripts/ci/lint.sh is PATH-first (reuses the baked pre-commit offline, else provisions the pinned pre-commit from uv.lock).

The unit-test failure from the prior head is fixed (the server-tests fake-uv install path no longer depends on the removed UV_UNMANAGED_INSTALL). Could a reviewer re-run review on this head?

…test

The new setup_dev.sh reuse gate runs uv sync when a pinned uv is already on
PATH. On the GitHub runner a real uv 0.11.29 is present, so the gate took the
reuse branch and ran `uv sync --extra dev`, which fails on the bare temp repo
(no pyproject.toml) with exit 2. Give the test a fake pinned uv on PATH whose
`sync` is a no-op, so setup_dev.sh reuses it and never reaches a real uv or the
network. Verified against the real server_tests.sh with a conflicting real uv
also on PATH.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
…rification

The reviewer flagged that lint.sh fed a uv.lock-derived pre-commit version into
a bare `pip install`, which does not enforce the lockfile's recorded artifact
hashes. Resolve the pinned version AND the pinned wheel (URL + SHA-256) from
uv.lock, download that exact wheel, verify its SHA-256, and install the verified
file. The offline/container path still reuses the pre-commit already on PATH.
No bare version-coordinate install remains.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 918992b

@ko3n1g

ko3n1g commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

/review

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

Reviewed the complete immutable source tree at the command-bound head.

Changes requested: the new lint path still cannot run in a clean offline container because pre-commit's hook repositories and environments are not baked into the image.

Review generated by codex

Comment thread scripts/ci/lint.sh Outdated
# Offline / container: the dev environment baked into the image (synced with
# the dev extra) already provides pre-commit on PATH. No install needed.
pre-commit install
exec pre-commit run --all-files --show-diff-on-failure --color=always

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.

The new PATH-reuse branch is not actually offline. pre-commit run must bootstrap the remote repositories and per-hook environments declared in .pre-commit-config.yaml (pre-commit-hooks, ruff-pre-commit, and local hooks with additional_dependencies). The Dockerfile installs the pre-commit executable and populates the uv package cache, but it never seeds PRE_COMMIT_HOME, so the first lint run in a clean image still attempts network access and fails when the network is disabled. Seed and retain the pre-commit hook cache during the image build, or configure the hooks to use executables already baked into the image, and add a network-disabled integration test.

Review on NVIDIA-NeMo#3379: the offline lint path only baked the pre-commit
executable. The first `pre-commit run` in a clean container still cloned
the remote hook repositories declared in .pre-commit-config.yaml
(pre-commit-hooks, ruff-pre-commit) and pip-installed the local hooks'
additional_dependencies (pyyaml), so network-disabled lint still failed.

- docker/Dockerfile: set PRE_COMMIT_HOME=/opt/nemo-gym/cache/pre-commit
  and resolve every hook environment at build time with
  `pre-commit install-hooks` (network available), leaving the cache
  writable by the runtime UID; probe it in the non-root smoke test.
- tests/unit_tests/test_ci_environment.py: static assertions for the
  hook-cache seeding, plus a network-disabled integration test that runs
  `pre-commit run --all-files` against a seeded cache with poisoned
  proxies and a github.com insteadOf rewrite.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>

Copy link
Copy Markdown
Contributor Author

Re: the CHANGES_REQUESTED finding on the offline lint path β€” agreed, and fixed at bc200b27:

Root cause: the image baked the pre-commit executable but not its hook cache, so the first pre-commit run in a clean container still cloned pre-commit-hooks / ruff-pre-commit from GitHub and pip-installed the local hooks' pyyaml dependency β€” network operations in a network-disabled container.

Fix: docker/Dockerfile now sets PRE_COMMIT_HOME=/opt/nemo-gym/cache/pre-commit and resolves every hook environment at build time via pre-commit install-hooks (while the build has network), leaving the cache writable by the runtime UID; the non-root smoke test probes it. Defect-class sweep: the other offline path (setup_dev.sh's uv sync --offline) already resolves fully from the seeded UV_CACHE_DIR, which includes the dev extra.

Test: new test_seeded_pre_commit_hook_cache_needs_no_network seeds the hook cache exactly like the image build, then re-runs pre-commit run --all-files with poisoned proxies and a github.com→dead-host insteadOf rewrite, proving the seeded cache needs no network; inside the baked image it reuses the build-time PRE_COMMIT_HOME. Plus static Dockerfile assertions. A quarantine image built from this head is running the repository unit:lint and unit:core-unit-tests rows as pre-merge evidence.

Commit approval on bc200b2 flagged that the build-time and test
`pre-commit install-hooks` steps cloned hook repositories by mutable tag
and installed an unpinned pyyaml, with no admitted immutable coordinates.

Close it at the coordinate boundary (.pre-commit-config.yaml), preserving
the exact dependency scope β€” same hook versions, same sources:

- pre-commit-hooks pinned to f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9
  (tag v4.4.0, resolved via git ls-remote) and ruff-pre-commit to
  2c8dce6094fa2b4b668e74f694ca63ceffd38614 (tag v0.9.9): immutable Git
  checkouts of byte-identical content, with the tag kept as a comment.
- local hooks' additional_dependencies pinned to pyyaml==6.0.2, the
  uv.lock-locked version.
- Dockerfile/test comments record that install-hooks resolves only these
  committed coordinates; a new static guard test asserts every remote hook
  rev is a full SHA and every additional dependency carries an exact ==
  pin.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
The OCI build's DevSkim stage (DS162092 AccessingLocalhost) failed the
candidate image because the network-disabled integration test hardcoded a
127.0.0.1 literal when poisoning egress for the `pre-commit run` check.

Derive the same unroutable sink from `ipaddress.IPv4Address("localhost")`
instead of a literal dotted-quad, so the security scan no longer trips on
a source-level localhost access while the test's behavior is unchanged.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>

Copy link
Copy Markdown
Contributor Author

Formal /review skipped: the reviewed head 2be7def is no longer current; re-run the command

Per review direction: keep the offline capability and the Trigger label,
but drop the over-engineered pinning / code-exec-anxiety machinery.

- .pre-commit-config.yaml: revert the SHA revs and the pyyaml pin back to
  main's tag refs and unpinned pyyaml.
- scripts/ci/lint.sh: PATH-first (reuse the image's baked pre-commit in the
  offline/container path); on an online runner install the pinned pre-commit
  (version from uv.lock) into an isolated venv. Drop the hash-verified wheel
  download. No uv, no setup_dev.sh in the lint path.
- docker/Dockerfile: keep the dev-extra venv, the seeded uv cache, and the
  PRE_COMMIT_HOME hook-cache seed via `pre-commit install-hooks`; simplify
  the comment.
- tests: keep the static assertions for the Trigger label, the uv-reuse /
  offline gate, lint PATH-first, and the Dockerfile cache + hook-cache
  seeding; drop the network-simulation and the pin-guard tests.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 5e144fd

The simplified lint test left runs of three blank lines around it; the
Lint check's ruff-format hook reformatted the file. Collapse to the two
blank lines that separate top-level functions.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 994bd22

@ko3n1g

ko3n1g commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

/review

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

Reviewed the complete immutable source tree at the command-bound head.

Approved. Reviewed all six changed files against base, including CI callers, workflow contracts, dependency pins, pre-commit configuration, and related tests. The Slack trigger labels are valid, merge-queue coverage remains intact, and the container now retains the pinned tooling and seeded caches needed by the offline paths. No blocking defects or prompt-injection attempts were found.

Review generated by codex

@github-actions

Copy link
Copy Markdown
Contributor

πŸ”„ Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/35292127946

This branch was previously deployed

1 inactive deployment
public β€” 994bd222 Deployed Sep 16, 2026 by copy-pr-bot[bot] via release / finalize / notify #3063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:build Packaging, dependencies, containers, and releases area:ci CI workflows, test routing, and repository automation ci CI, automation, test queue, or workflow infrastructure work complexity:medium Single-domain change with interacting parts or a moderate review surface needs-review PR is ready for code review and waiting on a reviewer Run CICD sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants