Spike: source module test data from a GitHub Environment#36
Closed
MariusStorhaug wants to merge 4 commits into
Closed
Spike: source module test data from a GitHub Environment#36MariusStorhaug wants to merge 4 commits into
MariusStorhaug wants to merge 4 commits into
Conversation
- Pin the Process-PSModule reusable workflow to spike/environment-support, which adds an optional Environment input to the module test jobs. - Pass Environment: Testing and drop the caller-built TestData blob. A job that calls a reusable workflow cannot set an environment, so the caller cannot read environment-scoped secrets/variables itself; the binding happens inside the reusable workflow jobs. - Environment.Tests.ps1 now asserts TEST_ENV_SECRET / TEST_ENV_VARIABLE, which exist only in the Testing environment (not at repo level), proving the values were sourced from the environment. - Touch src/ so the change matches the ^src/ important-file pattern and the module build + local test jobs run.
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
… access in direct vs reusable jobs
…sted probe Cross-owner (personal -> org) cannot use secrets: inherit, so pass APIKey explicitly and prove environment VARIABLES end-to-end; skip the env secret assertion with a cross-owner note. Add env-probe-mid.yml for a 3-level nested inherit + env-binding probe mirroring caller -> workflow.yml -> Test-ModuleLocal.
Owner
Author
Spike results — using Process-PSModule with a GitHub Actions EnvironmentQuestion: can the Process-PSModule reusable workflow consume a GitHub Environment How it works
Findings (all proven on live runs)
Evidence
Notes
|
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.
Spike: use Process-PSModule with a GitHub Actions Environment
Proves that the Process-PSModule reusable workflow can source module test
secrets and variables from a GitHub Actions Environment instead of a
caller-built
TestDatablob.What changed
PSModule/Process-PSModule@spike/environment-support(adds anoptional
Environmentinput) and passesEnvironment: Testing.TestDatasecret is intentionally dropped so the environment is the onlypossible source.
tests/Environment.Tests.ps1assertsTEST_ENV_SECRET/TEST_ENV_VARIABLE,which exist only in the
Testingenvironment (not at repo level).src/file is touched so the module build + local test jobs actually run.Why the environment binding lives in the reusable workflow
A job that calls a reusable workflow cannot set
environment:(workflow_call hasno environment keyword), so the caller cannot read environment-scoped
secrets/variables. Instead, the
BeforeAll/Test/AfterAll-ModuleLocaljobs insidethe reusable workflow bind to the environment and expose
toJSON(secrets)/toJSON(vars)to the tests viaImport-TestData.Expected result
Test-ModuleLocalpassesEnvironment.Tests.ps1, confirming the environmentsecret (masked) and variable reached the Pester tests.