CI: Add ansible-lint workflow for Ansible playbooks#3796
CI: Add ansible-lint workflow for Ansible playbooks#3796arkid15r merged 16 commits intoOWASP:mainfrom
Conversation
Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
WalkthroughAdds ansible-lint to pre-commit for Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/lint-ansible.yaml:
- Around line 18-24: Add version-tag comments next to the pinned action SHAs
used in the workflow so future readers know which release each SHA refers to:
update the uses entries for
actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd and
ansible/ansible-lint@7f6abc5ef97d0fb043a0f3d416dfbc74399fbda0 by appending
inline comments with their corresponding tags (actions/checkout v6.0.2 and
ansible/ansible-lint v26.1.1) to improve maintainability while keeping the SHA
pins intact.
🧹 Nitpick comments (1)
.github/workflows/lint-ansible.yaml (1)
3-7: Consider adding the workflow file itself to thepathsfilter.Changes to this workflow file (
.github/workflows/lint-ansible.yaml) won't trigger a CI run because it isn't included in thepathsfilter. This means modifications to the linting configuration or action versions won't be validated until an unrelated Ansible file change triggers the workflow.Proposed fix
on: pull_request: paths: - .github/ansible/** + - .github/workflows/lint-ansible.yaml workflow_dispatch:
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
just a quick note: |
arkid15r
left a comment
There was a problem hiding this comment.
Can we have it as a part of our general approach available both locally and on CI/CD?
|
sure |
Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>
Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.pre-commit-config.yaml:
- Around line 91-98: The ansible-lint pre-commit hook (hook id: ansible-lint)
currently passes args only for the target path; update the hook configuration in
.pre-commit-config.yaml to add the --skip-list yaml argument so local runs match
CI and skip the conflicting yaml rule; locate the ansible-lint hook block (repo:
https://github.com/ansible/ansible-lint, id: ansible-lint) and append
--skip-list yaml to its args array alongside the existing .github/ansible entry.
- Line 92: Update the ansible-lint pre-commit hook to the latest release by
changing the rev value from "v24.7.0" to "v26.1.1" in .pre-commit-config.yaml
(look for the ansible-lint hook entry and the line "rev: v24.7.0"); ensure the
hook id remains "ansible-lint" and run pre-commit autoupdate or a local
pre-commit run to verify the new version installs and passes.
🧹 Nitpick comments (1)
Makefile (1)
66-67: Minor: Add@prefix for consistency with other targets.Other
pre-commitinvocations in this Makefile (e.g., Line 54) use the@prefix to suppress command echoing. This target should follow the same convention.Proposed fix
lint-ansible: - pre-commit run ansible-lint --all-files + `@pre-commit` run ansible-lint --all-files
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="Makefile">
<violation number="1" location="Makefile:67">
P2: `make lint-ansible` no longer skips the ansible-lint `yaml` rule. The pre-commit hook doesn’t add `--skip-list yaml`, so the previous behavior is lost and this target will start enforcing ansible-lint’s YAML formatting rules again. If the skip is still desired, pass it through the pre-commit run.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
|
Locally we can run make lint-ansible and also with pre-commit it will work. |
Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.github/ansible/production/nest.yaml:
- Line 11: Add a step in both CI jobs (deploy-staging-nest and
deploy-production-nest) to run "ansible-galaxy collection install -r
requirements.yml" before invoking ansible-playbook so the ansible.posix
collection (required for ansible.posix.synchronize) is installed on the runner;
update the workflow to run that command (using the repository checkout and
correct working-directory if needed) immediately prior to the ansible-playbook
step in each job.
In @.github/ansible/staging/nest.yaml:
- Around line 23-28: The task name "Update Makefiles for production environment"
is incorrect for this staging playbook; update the task name string to reflect
staging (e.g., "Update Makefiles for staging environment") so it matches the sed
commands that replace nest-*- to staging-nest-*; locate the Ansible task with
that exact name and change it to mention "staging" (leave the
ansible.builtin.shell block and sed lines unchanged).
🧹 Nitpick comments (1)
.github/ansible/production/proxy.yaml (1)
23-26:changed_when: falsemasks real state changes on deployment tasks.
docker compose up -d --pull always && docker compose restartalways mutates host state (pulling images, recreating containers). Marking itchanged_when: falsesuppresses meaningful change reporting. For a deploy playbook this is a pragmatic trade-off to silenceno-changed-when, but be aware it hides actual drift from any callback/reporting plugin.If you want more accurate reporting, consider registering the result and using a condition like
changed_when: "'Started' in result.stdout"or similar.
Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>
There was a problem hiding this comment.
2 issues found across 9 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name=".github/ansible/staging/nest.yaml">
<violation number="1" location=".github/ansible/staging/nest.yaml:56">
P2: Missing `run_once: true` directive. This task is delegated to localhost and was previously configured to run only once regardless of the number of target hosts. Without `run_once: true`, the secret cleanup will execute redundantly for each host in the inventory group.</violation>
</file>
<file name=".github/ansible/production/nest.yaml">
<violation number="1" location=".github/ansible/production/nest.yaml:51">
P2: Missing `run_once: true` directive changes playbook behavior. This task delegates to localhost to clean up secret files - without `run_once`, it will run once per host in the inventory (redundantly deleting the same files). The original code had `run_once: true` for a reason. To satisfy ansible-lint while preserving behavior, keep `run_once` with the noqa comment.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3796 +/- ##
=======================================
Coverage 93.68% 93.68%
=======================================
Files 463 463
Lines 14420 14420
Branches 1939 1939
=======================================
Hits 13509 13509
Misses 535 535
Partials 376 376
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
arkid15r
left a comment
There was a problem hiding this comment.
Okay, let's see if it works.
|
@hassaansaleem28 you have useful ideas but you don't get your implementations fully benefit from them 27e6d1f |
@arkid15r Thank you so much for your feedback (also for the merge), you're right. I will surely improve in this with time in my upcoming PRs. From now on, I will ensure that the implementation fully matches the intent. |
* Run make update * Clean up snapshot generated videos * Update backend/data/nest.dump * feat(ui): revamp corporate supporters carousel (Infinite Marquee + Dark Mode fix) (#3837) * feat(ui): revamp corporate supporters carousel (Infinite Marquee + Dark Mode fix) * fix: resolve failing test case * fix: add fallback text for unnamed sponsors * docs: add docstrings to satisfy coverage requirements * Run make check and fix tests. --------- Co-authored-by: Kate <kate@kgthreads.com> * Fix/redundant typescript assertion (#3834) * Fix Sonar S4325 by narrowing session user fields instead of casting * Fix unused ExtendedSession in mentorship page * fix: redundant-typescript-assertion * Fix stale latest date displayed in Project Health Dashboard metrics (#3842) * Fixed latest date in proejct health dashboard * updated order * Update code * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> * feat: improve backend test coverage to 96% (#3840) * feat: improve backend test coverage to 96% * fix comments * fix issues * fix issue * fix cubic-dev-ai comments * Update code * Fix tests --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> * Fix: merge consecutive RUN instructions in frontend Dockerfile (#3644) * Fix: merge consecutive RUN instructions in frontend Dockerfile * fix: comment Dockerfile note to prevent syntax error * Update code * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> * Fix 'is_merged' not being available on the Issue (#3843) * Fix 'is_merged' not being available on the Issue * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> * CI: Add ansible-lint workflow for Ansible playbooks (#3796) * ci: add ansible-lint workflow Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> * Update .github/workflows/lint-ansible.yaml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * ci: add ansible-lint make target and workflow Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> * ci: add ansible-lint pre-commit hook Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> * fix: whitespace & version Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> * Update Makefile Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * ci: enable ansible-lint scanning and add requirements.yml Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> * chore(ansible):align linting and module usage Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> * ci(ansible): install collections before deploy playbooks Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> * Update code * Update code * Update .github/workflows/run-ci-cd.yaml --------- Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> * Fix ElevenLabs API error (#3861) * use default liam voice * bump speed by 0.10 --------- Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> * Add Ime Iyonsi to MENTORS.md (#3866) * Add mentor profile for Ime Iyonsi Added Ime Iyonsi's mentor profile. * Fix GitHub link for Ime Iyonsi Corrected GitHub link for Ime Iyonsi. * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> * Update MENTORS.md * Enabled Strict Mode (#3776) * Enabled Strict Mode * fixed ai review * fix * fixed review * fix * update test * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> * Resolve case-sensitivity in QueryParser to support Chapters/Members search (#3844) * resolve query parser blocker * use case_sensitive flag in QueryParser * feat: add case_sensitive option to QueryParser and update tests * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> * Update dependencies (#3874) * Update dependencies * Bump django-ninja version * fix(proxy): pin nginx and certbot images (#3848) * fix(proxy): pin nginx and certbot images Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> * fix stable verssions Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> --------- Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> * Update docker-compose/proxy/compose.yaml * Update backend/pyproject.toml * Update ansible lint configuration (#3880) * Update .github/ansible/.ansible-lint.yaml * Improve frontend test coverage above 80% and add missing test files (#3864) * Imrove test coverage to 80% and added test * Fixed coderabbit review * update code * fixed coderabbit ai * fixed soanrqube warning * fixed review * update * fixed aloglia cache_key (#3825) * fixed aloglia cache_key * change separator val to be semicolon (;) * Update code * add tests + use json filters * add trailing newline * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> * fix: remove unused className prop from AnchorTitle component (#3822) * fix: remove unused className prop from AnchorTitle component Fixes #3805 The className prop was defined in AnchorTitleProps but never used in the component implementation. Removing it resolves Sonar rule typescript:S6767 and improves code maintainability. * fix: use className prop instead of removing it - Added className back to AnchorTitleProps interface - Accept className parameter in component - Apply className to root div element - Resolves reviewer feedback on PR #3822 * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> --------- Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> Co-authored-by: Yashraj Pahuja <yashrajpahuja9999@gmail.com> Co-authored-by: Kate <kate@kgthreads.com> Co-authored-by: CodeAritraDhank <aritradhank21@gmail.com> Co-authored-by: Anurag Yadav <143180737+anurag2787@users.noreply.github.com> Co-authored-by: Harshit Verma <harshit1092004@gmail.com> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> Co-authored-by: Shuban Mutagi <shubanmutagi55@gmail.com> Co-authored-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: emaybu <152900874+emaybu@users.noreply.github.com> Co-authored-by: sai chethana <saichethanavesireddy@gmail.com> Co-authored-by: Rahul Paul <179798584+Mr-Rahul-Paul@users.noreply.github.com> Co-authored-by: Lavanya <lavanyayadawad30@gmail.com>






Proposed change
Resolves #3747
Description
Adds a local Make target and a dedicated GitHub Actions workflow to run ansible‑lint on .github/ansible/** in PRs.
Why
Catches Ansible playbook issues early (syntax, deprecated patterns, best‑practice violations) before deployment.
Changes
Notes
Checklist
make check-testlocally: all warnings addressed, tests passed