cicd

oleh nvidia

Referensi CI/CD untuk NeMo-RL. Mencakup struktur pipeline GitHub Actions, pemicuan CI melalui /ok to test, dan investigasi kegagalan CI.

npx skills add https://github.com/nvidia-nemo/rl --skill cicd

CI/CD Guide


How CI Works

NeMo-RL CI runs on GitHub Actions. Workflows live in .github/workflows/.

The main test workflow triggers on pushes to pull-request/<number> branches. These branches are created automatically by copy-pr-bot when a contributor pushes to their fork and the PR receives a trust signal:

  • The commit is GPG-signed by a maintainer, or
  • A maintainer posts /ok to test <full-sha> as a PR comment.

Triggering CI

After pushing a new commit to your PR, trigger CI with:

/ok to test <full-commit-sha>

Use git rev-parse HEAD (not the short form) to get the full SHA.

Re-triggering after new commits: each /ok to test <sha> is specific to that SHA. After pushing additional commits, post a new comment with the updated SHA.

Nightly CI with /nightly-ci

Members of the automation or rl_autobot_approvers GitHub teams can comment /nightly-ci test-case=<test> to run NVIDIA's nightly CI and build the RL image from the PR head. Fork PRs first need /ok to test <full-sha> vetting and a copy-pr-bot mirror matching that head.

With run_as: requester, the pipeline runs as the commenter. NVIDIA employees must enroll once as described in the internal Autobot /nightly-ci docs; unenrolled requests receive a neutral check. See the CI/CD guide for settings and the Autobot nightly CI check. A new push supersedes the run without cancelling the running pipeline.


CI Labels

Every PR must have exactly one CI:* label — the quality-check job stays red until one is attached. A bot sets it (see below). Labels control which test tier runs and whether a new container image is built.

LabelWhat runsContainer
CI:docsLint + Sphinx docs build onlyNone (no GPU)
CI:LfastFast test subsetReuses main container (PRs to a release branch such as r0.8.0 reuse that branch's container, published only by pushes to that branch after merges)
CI:L0Unit tests + docs + lintBuilds new image
CI:L1L0 + functional testsBuilds new image
CI:L2Same as L1 today (plan to add convergence tests)Builds new image
Skip CICDNothing (skips all tests)—

Default on merge group / push to main: L1.

The label is set automatically. The Set CI label workflow (.github/scripts/ci_label.py) picks it from the changed files on every push, first match wins:

Changed filesLabel
Any pyproject.toml, uv.lock, Dockerfile*, docker/**.sh, docker/**.py or 3rdparty/**CI:L1
Only *.md, docs/**, skills/**, or .github/** files the main CI run doesn't readCI:docs
Anything elseCI:Lfast

These .github/ files feed the main CI run, so they still mean CI:Lfast: workflows/cicd-main.yml, workflows/_build_container.yml, actions/test-template/*, scripts/plan-tests.sh, scripts/checkout-megatron-lm-commit.sh, scripts/install-megatron-lock-artifact.sh and scripts/known-flake-patterns.txt.

Only repo maintainers (admin or maintain role) can change it, for example to CI:L1 for a broad core change, or add Skip CICD. A label anyone else sets is replaced, and the bot says so in one PR comment. A maintainer's label stays until a push changes the bot's own pick. Agents: do not set or change CI:* labels on PRs to main. Release branches have no label bot, so cp-to-release still copies the original PR's label.


CI Failure Investigation

# List recent workflow runs for the PR
gh run list --repo NVIDIA-NeMo/RL --branch "pull-request/<pr-number>"

# View failing run summary
gh run view <run-id> --repo NVIDIA-NeMo/RL

# Stream failing job output
gh run view <run-id> --repo NVIDIA-NeMo/RL --log-failed

Common failure patterns:

SymptomLikely causeFix
CI never startsNo trust signal or copy-pr-bot not triggeredPost /ok to test <sha>
semantic-pull-request failsPR title doesn't follow Conventional CommitsFix PR title; see contributing skill
Linting failsStyle violationRun uv run ruff check --fix . && uv run ruff format .
Unit test failureCode regression or missing dependencyReproduce locally; see testing skill
CPU config checks fails (on a PR, the rest of the run is cancelled)A recipe config, test-suite list or nightly GPU-hour budget check failed (tests/unit/test_recipes_and_test_suites.py, tests/unit/test_config_validation.py)Reproduce on Linux (the lockfile has no macOS wheels) with cd tests && RAY_ENABLE_UV_RUN_RUNTIME_ENV=0 HF_HOME=${HF_HOME:-$HOME/.cache/huggingface} uv run --group test pytest unit/test_recipes_and_test_suites.py unit/test_config_validation.py; the job runs on a GitHub-hosted CPU runner with these two variables set

Re-running CI

To retry a failed run on the same commit, re-run only the failed jobs:

gh run rerun <run-id> --failed --repo NVIDIA-NeMo/RL

In the UI this is Re-run jobs → Re-run failed jobs. It keeps every job that already passed and also re-runs jobs that were cancelled or skipped because of a failed job, including a run cancelled by a failing CPU config checks job.

Rules for agents:

  • Never run gh run rerun <run-id> without --failed, and never suggest Re-run all jobs. A full re-run repeats every GPU job on a commit that already passed most of them.
  • Read the failure first (gh run view <run-id> --log-failed). Re-run only when the failure is unrelated to the change: a known flaky test, a download or network error, a runner or container problem.
  • If the failure comes from the change, fix it and push. A new commit needs a new /ok to test <full-sha> comment; do not re-run the old commit.
  • Do not push empty commits to re-trigger CI; use --failed on the existing run.