Split framework env vars off the CDT prefix#9
Merged
Merged
Conversation
Zero callers across the tree. cmd/login.go reads passwords directly with terminal.ReadPassword and uses appCtx.PasswordEnvVar() for the non-interactive override; this helper was superseded scaffolding. Removes the hardcoded CDT_JENKINS_PASSWORD literal from scope.
helper.LoadDebugFlags and helper.HasDebugFlag were reading the hardcoded CDT_DEBUG_FLAGS literal, contradicting the context's DebugFlagsEnvVar() method that was supposed to be the source of truth for the env var name. Route both reads through appCtx.DebugFlagsEnvVar() (returns <APPNAME>_DEBUG_FLAGS — e.g. COLA_DEBUG_FLAGS for the cola binary). Fall back to an empty string when no context is initialised, so early bootstrap paths don't crash.
readSecret() was reading hardcoded CDT_VAULT_SECRET and CDT_VAULT_SECRET_FILE literals. Vault state is per-launcher (the file vault directory and cache live under the per-app tree), so the env vars that unlock that state should match the launcher the user is invoking, not stay frozen on the upstream CDT prefix. Add VaultSecretEnvVar() and VaultSecretFileEnvVar() to LauncherContext; route the two reads through them. For the cola binary the names become COLA_VAULT_SECRET and COLA_VAULT_SECRET_FILE. file-vault_test.go now initialises the context once via TestMain- style init() with appName "testvault" so the derived env var is a stable TESTVAULT_VAULT_SECRET that all three tests can target.
Vault tests now own their env var lifecycle via t.Setenv against a known-initialised context (TESTVAULT_VAULT_SECRET), so no test relies on an inherited shell variable any more. The hardcoded CDT_* literal here was the last reference to the upstream prefix in CI.
TestAccessConsents flows through helper.SetSecret, which on Linux runners always picks the file vault. Vault init calls readSecret(), which after the env-var split looks up the per-app <APPNAME>_VAULT_SECRET. The test was previously relying on the workflow's CDT_VAULT_SECRET env block to satisfy that read; with that env block gone in Bundle 4 the test crashed on CI runners that have no ~/.ssh fallback. Set the env var explicitly via t.Setenv, keyed off the context's own VaultSecretEnvVar() so the test stays correct if the derivation rule changes. Also switch the appName from "test-vault" to "testconsent" so the derived env var name has no dash.
The integration test binary builds with appName=cl, so after the env-var split the file vault now reads CL_VAULT_SECRET rather than the inherited CDT_VAULT_SECRET from the workflow env. CI runners have no ~/.ssh fallback, so without the env var being set, every helper.GetSecret/SetSecret call on Linux fails — which broke test-consent, test-manifest, test-template and the new test-workspace suites once the workflow env block went away. Set CL_VAULT_SECRET in the test runner itself so the integration tests are self-contained on this dimension regardless of how CI is configured. Safe on macOS / Windows where keyring is preferred.
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
Four atomic commits that move the launcher's own behaviour env vars off the hardcoded
CDT_*prefix and onto the binary-derived<APPNAME>_*form everything else in the codebase already uses.3af5b9chelper.ReadPassword— zero callers;cmd/login.goreads passwords directly. RemovesCDT_JENKINS_PASSWORD.852f785helper.LoadDebugFlags/HasDebugFlagread fromappCtx.DebugFlagsEnvVar()(<APPNAME>_DEBUG_FLAGS).633a209VaultSecretEnvVar()/VaultSecretFileEnvVar()onLauncherContext;gvault.readSecret()reads through them. Test uses afunc init()to setappName=testvault, so the env var is a stableTESTVAULT_VAULT_SECRET.358d66aCDT_VAULT_SECRETfrom.github/workflows/go.yml— tests now own their env lifecycle viat.Setenv.The design call:
<APPNAME>_*(binary-derived) rather than a fixedCOLA_*framework prefix. Same pattern as every other launcher-managed env var already routed throughappCtx.EnvVarName(). A user running two launchers gets independent state; mirrors the on-disk story where~/.<appname>/is per-binary.Test plan
Verified locally before push:
./build.shcleango build ./... && go vet ./...cleango test ./...all packages pass./test/integration.sh19/19 suites passcd gh-pages && npm install && npm run testmarkdownlint cleanCDT_VAULT_SECRETunset in the shell