Skip to content

fix(infra): onboard, plan and apply read one requirements file #6698

Closed

Description

@dan-petty

Problem

Checked at devops-cli main 52126db.

  • The collections row of devops infra onboard reads collections/requirements.yml or collections/requirements.yaml (_REQUIREMENTS_FILES in src/devops_cli/infra/repo_content.py:37).
  • devops infra plan and devops infra apply install only collections/requirements.yml (REQUIREMENTS_FILE, used by install_collections in src/devops_cli/infra/plan.py). The roles row of onboard installs the same file.
  • A repo that holds only collections/requirements.yaml gets a present collections row, but plan and apply then run with no pinned collection installed.

Proposed remedy

Use one rule for the file name in onboard, plan and apply: either install the file that read_collection_requirements finds, or make the collections row accept only collections/requirements.yml and name the file in its step.

Acceptance criteria

  • A new test fails on main and passes on the branch: a repo with only collections/requirements.yaml gets the same answer from the collections row and from the install of plan.
  • uv run devops ci --check --only test,lint,typecheck passes.

Person steps

None.

Dependencies

None.

Source

Source: #6678

Alternatives check of 2026-11-21: none.
Tool: none found.
Reason: Searches found only Ansible runtime images and docs, none of which discovers a repository's collection requirements file. The mismatch is between two functions of this CLI, so no external tool covers it.

Lacks:

  • No discovery of collections/requirements.yml or .yaml
  • No shared file-name rule between onboard and plan
  • No parity test for a .yaml-only repository

Proposed design

Problem statement

The infra commands do not agree on the collection requirements file. devops infra onboard accepts collections/requirements.yml and collections/requirements.yaml, but devops infra plan, devops infra apply, and the onboard roles row install only collections/requirements.yml. A repository with only the .yaml file shows a present collections row and then runs with no pinned collection.

Acceptance criteria

Requirement: Collections row and install agree

The collections row and the install path SHALL name the same collection requirements file.

Scenario: YAML-only repository

  • WHEN A test in tests/commands/test_infra_onboard.py creates a project with only collections/requirements.yaml, calls the collections-row reader, and calls the shared requirements-file helper.
  • THEN The collections row reports the file as present, and the helper returns collections/requirements.yaml.

Requirement: Plan install uses the discovered file

The plan and apply install step MUST install the collection requirements file that the shared discovery rule returns.

Scenario: Plan on a YAML-only repository

  • WHEN A test gives a project with only collections/requirements.yaml to install_collections and replaces install_requirements with a recorder.
  • THEN The recorder receives the path collections/requirements.yaml.

Requirement: Onboard roles row uses the discovered file

The onboard roles row MUST install the collection requirements file that the shared discovery rule returns.

Scenario: Onboard on a YAML-only repository

  • WHEN A test runs the onboard roles row for a project with only collections/requirements.yaml.
  • THEN The install command names collections/requirements.yaml.

Requirement: Scoped CI checks pass

The change MUST pass the repository checks for test, lint and typecheck.

Scenario: Scoped CI check

  • WHEN A person runs uv run devops ci --check --only test,lint,typecheck.
  • THEN The command exits 0 with every check passing.

Existing Tool Considered

No open, maintained tool covers this need. The alternatives check in the issue body records the verdict none and lists the lacks. The change adds one small shared helper and edits its call sites: about 2,000 tokens to build, 500 tokens to keep and fix, and less than one hour of elapsed time.

Key questions

  • Which file-name rule should onboard, plan and apply use?: Use the existing _REQUIREMENTS_FILES order and one helper in repo_content.py. The helper returns the first existing path. The collections row, install_collections, and the onboard roles row use that path. (best practice) [sources: src/devops_cli/infra/repo_content.py:37, src/devops_cli/infra/repo_content.py:197, src/devops_cli/infra/plan.py:466, src/devops_cli/infra/onboard.py]
    • Chosen: Reuse the existing two-name discovery in one helper. The collections row already accepts both names, and one helper removes the drift that caused the defect.
    • Rejected: Accept only collections/requirements.yml. This breaks repositories that already use the .yaml name and changes the current present result.
    • Rejected: Repeat the two-name check in each caller. The repeated checks can drift again, which is the cause of this defect.
  • How should the install step receive the requirements path?: Pass the resolved path into install_requirements and the roles-row install. Do not keep REQUIREMENTS_FILE as the only source in these paths. (best practice) [sources: src/devops_cli/infra/plan.py:466, src/devops_cli/infra/ansible_facts.py:41, src/devops_cli/infra/onboard.py]
    • Chosen: Pass the resolved path as an argument. The caller and the installer then use the same file, and the helper stays the only name rule.
    • Rejected: Keep the constant and add a second .yaml branch in each caller. The branches can disagree and restore the defect.
    • Rejected: Change REQUIREMENTS_FILE to a list. A constant list still does not pass the selected file to the installer.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    scope/infra
    source/agent
    status/new
    value/medium
    effort/low
    on Nov 21, 2026
  2. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 21, 2026
  4. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (9)

    Tools considered:

    Searches run:

    • python library detect ansible collection requirements file yml yaml, results: 5
    • ansible-galaxy install collections requirements.yml or requirements.yaml both file names, results: 5
    • ansible-lint requirements.yml missing collection detection, results: 5
    • ansible-galaxy requirements.yml collections install documentation, results: 5
    • "requirements.yml" ansible collections, results: 5
    • ansible galaxy collection requirements file, results: 5
    • ansible-galaxy collection install -r requirements file docs.ansible.com, results: 5
    • galaxy requirements.yml yaml extension support ansible issue, results: 5
    • ansible-core pypi package, results: 5

    Sources:

  5. added
    status/ready
    and removed
    status/new
    on Nov 22, 2026
  6. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  7. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 23, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 23, 2026
  9. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    Contributor
  10. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-23 06:32 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/infrasource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions