Skip to content

Conversation

@tomjelinek
Copy link
Member

@tomjelinek tomjelinek commented Aug 26, 2025

Fix gitlab CI to run ansible-lint after converting the role to a collection. This makes it consistent with github CI and it is a recommended way of using ansible-lint anyway.

Summary by Sourcery

Update GitLab CI to run ansible-lint and ansible-test on the role after converting it to a collection, aligning with GitHub CI and recommended practices

Enhancements:

  • ansible_lint job now installs collection dependencies and converts the role to a collection before linting
  • ansible-lint invocation skips the yaml[line-length] rule to avoid errors from reformatting during role conversion
  • ansible_test job also converts the role to a collection before running ansible-test
  • added pwd command to the convert_role_to_collection anchor for improved visibility

@tomjelinek tomjelinek requested a review from richm as a code owner August 26, 2025 08:27
@sourcery-ai
Copy link

sourcery-ai bot commented Aug 26, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the GitLab CI pipeline to convert the Ansible role into a collection before running ansible-lint and ansible-test, aligning it with GitHub CI and recommended usage of ansible-lint.

Flow diagram for ansible-lint job after role conversion

flowchart TD
    Start([Start ansible_lint job])
    InstallDeps[Install collection dependencies]
    ConvertRole[Convert role to collection]
    CopyConfig[Copy .ansible-lint config]
    RunLint[Run ansible-lint]
    Start --> InstallDeps --> ConvertRole --> CopyConfig --> RunLint
Loading

File-Level Changes

Change Details Files
Enhance collection conversion anchor
  • Add a pwd command to the convert_role_to_collection anchor
.gitlab-ci.yml
Run ansible-lint on the converted collection
  • Install collection dependencies with ansible-galaxy
  • Invoke the role2collection anchor
  • Copy .ansible-lint config from the converted role
  • Remove legacy exclude and skip-list flags
  • Update ansible-lint command to skip YAML line-length errors
.gitlab-ci.yml
Invoke role2collection before ansible-test
  • Add the convert_role_to_collection anchor to the ansible_test job
.gitlab-ci.yml

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

Copy link

@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 there - I've reviewed your changes - here's some feedback:

  • Remove the debug pwd call in the convert_role_to_collection step to avoid cluttering CI logs.
  • Rather than skipping 'yaml[line-length]' on the command line, consider adding that rule to the .ansible-lint config so the ignore is more explicit and maintainable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Remove the debug `pwd` call in the convert_role_to_collection step to avoid cluttering CI logs.
- Rather than skipping 'yaml[line-length]' on the command line, consider adding that rule to the .ansible-lint config so the ignore is more explicit and maintainable.

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.

@codecov
Copy link

codecov bot commented Aug 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.32%. Comparing base (32b8ef7) to head (fab3254).
⚠️ Report is 93 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #309      +/-   ##
==========================================
+ Coverage   82.88%   88.32%   +5.44%     
==========================================
  Files           6       11       +5     
  Lines         479      891     +412     
==========================================
+ Hits          397      787     +390     
- Misses         82      104      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tomjelinek tomjelinek merged commit fab3254 into linux-system-roles:main Aug 27, 2025
34 checks passed
@tomjelinek tomjelinek deleted the ci-fix-ansible-lint branch August 27, 2025 14:25
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.

3 participants