Skip to content

refactor: comply with Ansible partner certification checks#121

Merged
richm merged 1 commit intolinux-system-roles:mainfrom
richm:refactor-comply-with-ansible-partner-checks
Apr 7, 2026
Merged

refactor: comply with Ansible partner certification checks#121
richm merged 1 commit intolinux-system-roles:mainfrom
richm:refactor-comply-with-ansible-partner-checks

Conversation

@richm
Copy link
Copy Markdown
Contributor

@richm richm commented Apr 7, 2026

https://github.com/ansible-collections/partner-certification-checker/blob/main/README.md

Ensure that our code complies with these policies/checks and prepare for
improved ansible-lint and ansible-test checks.

The shell script jinja templates have been renamed to be .sh.j2. Older versions of ansible-test
use an old version of shellcheck which does not support shellcheck disable=all, which
causes ansible-test to error. I tried adding an ignore-2.14.txt to do shellcheck!skip
for these files, but then ansible-lint complained that shellcheck is unskippable.

In other roles e.g. nbde_client, we use the .sh.j2 suffix for shell script templates.

The .collection/ sub-dir causes problems for ansible-lint.

The which command is not built-in - use command -v instead.

Signed-off-by: Rich Megginson rmeggins@redhat.com

Summary by Sourcery

Refactor shell script templates and lint configuration to comply with Ansible partner certification checks and improve compatibility with ansible-lint and ansible-test.

Enhancements:

  • Rename SKU-related shell script templates to use the .sh.j2 suffix for better alignment with Ansible template and linting conventions.
  • Replace use of the non-built-in which command with command -v in the CUDA GPU test script to satisfy shellcheck and portability guidelines.

CI:

  • Adjust ansible-lint configuration to avoid issues with disallowed paths and checks under partner certification rules.

https://github.com/ansible-collections/partner-certification-checker/blob/main/README.md

Ensure that our code complies with these policies/checks and prepare for
improved ansible-lint and ansible-test checks.

The shell script jinja templates have been renamed to be `.sh.j2`.  Older versions of ansible-test
use an old version of shellcheck which does not support `shellcheck disable=all`, which
causes ansible-test to error.  I tried adding an ignore-2.14.txt to do `shellcheck!skip`
for these files, but then ansible-lint complained that `shellcheck` is unskippable.

In other roles e.g. nbde_client, we use the `.sh.j2` suffix for shell script templates.

The `.collection/` sub-dir causes problems for ansible-lint.

The `which` command is not built-in - use `command -v` instead.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
@richm richm requested a review from spetrosi as a code owner April 7, 2026 20:59
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 7, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the role to comply with Ansible partner certification and lint/test rules by renaming shell script templates to use a .sh.j2 suffix, updating the Ansible task references accordingly, fixing a shell portability issue, and adjusting ansible-lint configuration to avoid .collection-related problems.

Flow diagram for Jinja2 shell script template rendering with .sh.j2 suffix

flowchart TD
    A[Ansible role task
    template module
    src: sku/*.sh.j2] --> B[Ansible Jinja2 engine
    render template]
    B --> C[Rendered shell script file
    dest: setup_sku_customisations.sh]
    B --> D[Rendered shell script file
    dest: remove_sku_customisations.sh]
    B --> E[Rendered shell script file
    dest: test-sku-setup.sh]

    C --> F[hpc_azure_resource_dir/bin
    setup_sku_customisations.sh]
    D --> G[hpc_azure_resource_dir/bin
    remove_sku_customisations.sh]
    E --> H[hpc_azure_tests_dir
    test-sku-setup.sh]

    F --> I[Executed during SKU setup]
    G --> J[Executed during SKU removal]
    H --> K[Executed as SKU tests]
Loading

File-Level Changes

Change Details Files
Rename shell script Jinja templates to use .sh.j2 suffix and update Ansible tasks to reference the new names.
  • Change template source for setup SKU customisations script to use .sh.j2 suffix.
  • Change template source for removal SKU customisations script to use .sh.j2 suffix.
  • Change template source for SKU test script to use .sh.j2 suffix.
  • Ensure installed destinations for the rendered shell scripts remain unchanged.
tasks/main.yml
templates/sku/setup_sku_customisations.sh.j2
templates/sku/remove_sku_customisations.sh.j2
templates/sku/test-sku-setup.sh.j2
Fix shell portability and static-analysis compatibility in CUDA GPU test script.
  • Replace non-built-in which command with command -v when logging nvcc location.
  • Preserve existing verbose logging behavior and version checks for nvcc.
files/test-cuda-gpu.sh
Adjust ansible-lint configuration to comply with partner certification expectations and avoid .collection directory issues.
  • Update .ansible-lint configuration to avoid scanning or otherwise conflicting with the .collection/ subdirectory.
  • Align lint configuration with ansible-test/ansible-lint expectations for shellcheck handling of template files.
.ansible-lint

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@richm richm changed the title refactor: comply with Ansible partner certification checks [citest_skip] refactor: comply with Ansible partner certification checks Apr 7, 2026
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In test-cuda-gpu.sh, consider quoting the command -v expansion (e.g. verbose_log "nvcc location: $(command -v nvcc)" or assigning it to a variable and quoting that) to avoid potential word-splitting issues if the binary path ever contains spaces.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `test-cuda-gpu.sh`, consider quoting the `command -v` expansion (e.g. `verbose_log "nvcc location: $(command -v nvcc)"` or assigning it to a variable and quoting that) to avoid potential word-splitting issues if the binary path ever contains spaces.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@richm
Copy link
Copy Markdown
Contributor Author

richm commented Apr 7, 2026

[citest]

@dgchinner
Copy link
Copy Markdown
Collaborator

Changes look fine to me.

@richm richm merged commit e32ed4d into linux-system-roles:main Apr 7, 2026
20 checks passed
@richm richm deleted the refactor-comply-with-ansible-partner-checks branch April 7, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants