feat: add SCM servers support for private Git collection repositories#559
Merged
cidrblock merged 1 commit intoansible:mainfrom Mar 25, 2026
Merged
feat: add SCM servers support for private Git collection repositories#559cidrblock merged 1 commit intoansible:mainfrom
cidrblock merged 1 commit intoansible:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class, data-driven support for authenticating against private Git-hosted collection repositories in the execution-environment (EE) scaffold, aligning it with the existing galaxy_servers pattern and updating the generated GitHub Actions workflow + docs accordingly.
Changes:
- Introduces
ScmServerandEEConfig.scm_servers, and threads SCM token metadata into template rendering. - Updates the EE build workflow template to use per-server SCM secrets and post-process
context/_build/requirements.ymlviaenvsubst(removing~/.git-credentialshandling). - Converts scaffold docs to be dynamic (templated README + new
NEXT_STEPS.md) and updatesee_scaffolding.md+ fixtures/tests.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/ansible_creator/types.py |
Adds ENV_VAR_RE, ScmServer, and EEConfig.scm_servers; extends schema + TemplateData. |
src/ansible_creator/subcommands/init.py |
Passes scm_servers and derived token var names into templates. |
src/ansible_creator/resources/common/ee-ci/.github/workflows/ee-build.yml.j2 |
Generates dynamic SCM secret checks and envsubst post-processing for requirements. |
src/ansible_creator/resources/execution_env_project/README.md.j2 |
Templated README with dynamic secrets list (Galaxy/SCM) and file name. |
src/ansible_creator/resources/execution_env_project/NEXT_STEPS.md.j2 |
New templated setup checklist for required/optional secrets and variables. |
docs/ee_scaffolding.md |
Documents scm_servers, token flow, and security model. |
tests/units/test_init_ee.py |
Adds unit + integration coverage for ScmServer/EEConfig and EE scaffold output. |
tests/fixtures/common/ee-ci/.github/workflows/ee-build.yml |
Updates expected common workflow fixture output. |
tests/fixtures/project/ee_project/.github/workflows/ee-build.yml |
Updates expected project workflow fixture output. |
tests/fixtures/project/ee_project/README.md |
Updates expected scaffolded README fixture output. |
tests/fixtures/project/ee_project/NEXT_STEPS.md |
Adds expected scaffolded NEXT_STEPS fixture output. |
cspell.config.yaml |
Adds envsubst to ignore list. |
Comments suppressed due to low confidence (1)
src/ansible_creator/resources/execution_env_project/README.md.j2:23
- This README claims the workflow "fails fast if credentials are missing", but the generated workflow only emits
::notice::messages and continues regardless of missing secrets. Either update the wording to reflect the current behavior, or change the workflow to actually stop the build when required secrets are absent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Introduce ScmServer dataclass and dynamic workflow generation for private Git-hosted collections. Tokens are resolved via envsubst post-processing of the build context, with multi-stage build isolation ensuring tokens never reach the final image. - Add ScmServer dataclass with id, hostname, token_env_var fields - Wire scm_servers through EEConfig, TemplateData, and init.py - Replace hardcoded git-credentials step with dynamic envsubst - Convert README.md to Jinja2 template with dynamic secrets table - Add NEXT_STEPS.md.j2 for dynamic secrets setup checklist - Update docs/ee_scaffolding.md with SCM servers section - Add unit, integration, and end-to-end tests Made-with: Cursor
NilashishC
approved these changes
Mar 25, 2026
NilashishC
approved these changes
Mar 25, 2026
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.
Summary
ScmServerdataclass (id,hostname,token_env_var) for configuring private Git-hosted collection repositories, mirroring the existinggalaxy_serverspattern~/.git-credentialssetup andAAP_EE_BUILDER_*/SCM_TOKENenv vars with a dynamic, data-driven approach — Portal passesscm_serversvia--ee-configJSONenvsubstpost-processing ofcontext/_build/requirements.ymlafteransible-builder create, with multi-stage build isolation ensuring tokens never reach the final imageREADME.mdto a Jinja2 template with dynamic secrets table and adds a newNEXT_STEPS.md.j2template that dynamically enumerates all required secrets (Galaxy, SCM, Registry)Changes
Core (
types.py)ENV_VAR_REregex for validating uppercase env var namesScmServerfrozen dataclass withfrom_dict(),as_dict(),to_schema()EEConfig: newscm_serversfield,_KNOWN_KEYS,from_dict(),to_schema()TemplateData: newee_scm_serversandee_scm_token_varsfieldsWorkflow template (
ee-build.yml.j2)Configure Git credentialsstep (~/.git-credentials)envsubstresolves tokens incontext/_build/requirements.ymlee_scm_token_varsin build stepScaffolded files
README.md→README.md.j2with dynamic secrets tableNEXT_STEPS.md.j2with required/optional secrets checklistDocumentation
docs/ee_scaffolding.mdcovering schema, token flow, and securityTests
ScmServerunit tests,EEConfigintegration, end-to-end scaffolding with SCM serversExample CLI usage
Security
The multi-stage build generated by
ansible-builderensures tokens never reach the final image:ansible-builder creategenerates build context with unresolved${TOKEN}referencesenvsubstresolves tokens in the generatedcontext/_build/requirements.ymlbuildah budbuilds the image — resolved URLs exist only in the intermediategalaxystagefinalstage only copies installed collections (/usr/share/ansible), not source filesDepends on
Test plan
ScmServer.from_dict()validates id, hostname, token_env_varScmServer.from_dict()rejects invalid env var names (lowercase, dashes, leading digits)EEConfig.from_dict()parsesscm_serverslistgit-credentialsor hardcodedAAP_EE_BUILDER_*referencesNEXT_STEPS.mdis generated with correct SCM token namesMade with Cursor