Skip to content

Add workflow to validate source repos definitions and synchronise existing definitions#508

Open
MoteHue wants to merge 4 commits intomainfrom
source-repos-sanity-checks
Open

Add workflow to validate source repos definitions and synchronise existing definitions#508
MoteHue wants to merge 4 commits intomainfrom
source-repos-sanity-checks

Conversation

@MoteHue
Copy link
Copy Markdown
Contributor

@MoteHue MoteHue commented Apr 27, 2026

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a Python script to validate that repository definitions are consistent between Terraform and Ansible configurations. The review feedback identifies a bug in the group extraction logic where trailing spaces in Jinja2 templates would cause matching failures, and it recommends properly propagating the script's exit code using sys.exit() within a standard main entry block to ensure CI/CD pipelines can detect validation failures.

Comment thread scripts/validate-source-repos.py
Comment thread scripts/validate-source-repos.py Outdated
Comment thread scripts/validate-source-repos.py
@MoteHue MoteHue force-pushed the source-repos-sanity-checks branch 9 times, most recently from a775163 to 718fd7a Compare April 27, 2026 10:38
@MoteHue
Copy link
Copy Markdown
Contributor Author

MoteHue commented Apr 27, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a validation script, scripts/validate-source-repos.py, designed to synchronize repository lists and codeowner group assignments between Terraform and Ansible configurations. The review feedback focuses on improving the robustness and idiomatic quality of the script, specifically by using more efficient file-loading methods for JSON and YAML, preventing potential KeyError exceptions when accessing repository data, and ensuring group names are correctly normalized during parsing.

Comment thread scripts/validate-source-repos.py
Comment thread scripts/validate-source-repos.py Outdated
Comment thread scripts/validate-source-repos.py Outdated
Comment thread scripts/validate-source-repos.py Outdated
Adds a script which checks if the source repositories definitions in
ansible/inventory/group_vars/all/source-repositories and
terraform/github/terraform.tfvars.json are out of sync.

Calls this script via a workflow on PR and pushes to main.
@MoteHue MoteHue force-pushed the source-repos-sanity-checks branch from 718fd7a to 24426fb Compare April 27, 2026 10:44
@MoteHue MoteHue changed the title WIP: validate source repos Add workflow to validate source repos definitions and synchronise existing definitions Apr 27, 2026
@MoteHue MoteHue marked this pull request as ready for review April 27, 2026 10:54
@MoteHue MoteHue requested a review from a team as a code owner April 27, 2026 10:54
@stackhpc-ci
Copy link
Copy Markdown
Contributor

stackhpc-ci commented Apr 27, 2026

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Validation 🤖success

Validation Output


Warning: Deprecated attribute

  on repositories.tf line 20, in resource "github_repository" "repositories":
  20:       has_downloads,

The attribute "has_downloads" is deprecated. Refer to the provider
documentation for details.
Success! The configuration is valid, but there were some validation warnings
as shown above.


Terraform Plan 📖success

Show Plan

undefined

Pusher: @MoteHue, Action: pull_request, Working Directory: ``, Workflow: Terraform GitHub

@MoteHue
Copy link
Copy Markdown
Contributor Author

MoteHue commented Apr 27, 2026

Example failure here: https://github.com/stackhpc/stackhpc-release-train/actions/runs/24990491954/job/73174589214
(from before I fixed these repo definitions in this PR)

Comment thread scripts/validate-source-repos.py
Comment thread scripts/validate-source-repos.py Outdated
Comment thread scripts/validate-source-repos.py Outdated
Comment thread scripts/validate-source-repos.py Outdated
@MoteHue MoteHue force-pushed the source-repos-sanity-checks branch from 258d2b0 to d0056ed Compare April 27, 2026 12:49
@MoteHue MoteHue force-pushed the source-repos-sanity-checks branch from d0056ed to 7cd9eb2 Compare April 27, 2026 14:44
Comment thread .github/workflows/validate-source-repos.yml
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.

4 participants