GCSS-1132: detect manually-created (unmanaged) repositories#52
Open
dev-milos wants to merge 2 commits into
Open
GCSS-1132: detect manually-created (unmanaged) repositories#52dev-milos wants to merge 2 commits into
dev-milos wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a scheduled detection mechanism that surfaces repositories which exist in the organisation but are not yet managed by GCSS. They are presented in a single, continuously-updated PR assigned to reviewers - merge to bring the repo under management, or add it to
ignored_reposto acknowledge it.Closes #1132. Builds on the compare fix in #51.
Why
The Terraform-plan drift check only sees resources already in Terraform state, so a repository created by hand is invisible to it and never flagged. This detects those repos by importing the org and diffing against the managed config.
How it works
Merging the drift PR feeds the existing import-on-merge machinery (
promote-imported-configs), which Terraform-imports the repo into state (it is not re-created).Changes
.github/actions/compare/action.yamlkeepinput.changed(default) preserves existing import/bulk-import behaviour;new-onlyalso drops modified repos, leaving only repos that have no config yet..github/actions/drift-pr/action.yaml(new).github/workflows/detect-unmanaged-repos.yaml(new, reusable)new-only→ drift-pr.Consumer setup (config repo)
Add a scheduled caller, e.g.:
Requirement: the managing GitHub App must have org-wide ("All repositories") access - otherwise manually-created repos are invisible to the importer and won't be detected.
Testing
Validated end-to-end in a test org (milos-org) against real CI:
ignored_reposApply complete: 2 imported, 0 added, 0 changed), config promoted torepos/Known considerations