feat(secrets): add GCP Secret Manager provider#5404
Conversation
Add support for Google Cloud Secret Manager as a secrets provider, following the same factory registration pattern as the existing Vault provider. - Add GCPProviderConfig to config with project and credentials fields - Implement Provider with GetSecret, ListSecrets, and Close - Register provider factory via init() blank import - Add config validation and tests Signed-off-by: Mark Phelps <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## v2 #5404 +/- ##
==========================================
+ Coverage 52.12% 60.39% +8.26%
==========================================
Files 138 139 +1
Lines 13720 13820 +100
==========================================
+ Hits 7152 8347 +1195
+ Misses 5969 4763 -1206
- Partials 599 710 +111
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add gcp secret provider configuration (enabled, project, credentials) to both schema files to fix schema validation tests. Signed-off-by: Mark Phelps <[email protected]>
- Add unit tests for GCP config loading, validation, and manager initialization - Add GCP Secret Manager integration test using blackwell-systems emulator - Add emulator support to GCP provider via SECRET_MANAGER_EMULATOR_HOST env var - Update Dagger version to 0.19.11 and suppress nag messages in CI Signed-off-by: Mark Phelps <[email protected]>
- Add tests for ${secret:gcp:key} reference resolution in walkConfigForSecrets
- Add test for mixed providers (vault + file + gcp) in same config
- Add GCP reference to secret_references.yml testdata
- Add GCP secret reference case to env var expansion tests
Signed-off-by: Mark Phelps <[email protected]>
…build folder Signed-off-by: Mark Phelps <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds Google Cloud Secret Manager as a new secrets provider (registered via factory pattern), including configuration/schema updates and test/integration coverage.
Changes:
- Introduces a new
gcpsecrets provider implementation + factory registration. - Extends config structs, validation, enabled-provider tracking, and schemas to support
secrets.providers.gcp. - Adds unit tests and a Dagger-based integration test path using a GCP Secret Manager emulator.
Reviewed changes
Copilot reviewed 27 out of 29 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/server/analytics/prometheus/prometheus_mock.go | Fixes import aliasing for Prometheus v1 API mock. |
| internal/secrets/manager_test.go | Adds manager tests for GCP provider enablement/registration behavior. |
| internal/secrets/manager.go | Initializes/registers GCP provider when enabled. |
| internal/coss/storage/environments/git/gitlab/gitlab_mock.go | Fixes import aliasing for GitLab client mock. |
| internal/coss/secrets/gcp/provider_test.go | Adds tests for GCP factory registration and basic behaviors. |
| internal/coss/secrets/gcp/provider.go | Implements GCP Secret Manager provider and registers factory. |
| internal/config/testdata/secrets/gcp_provider_no_credentials.yml | Adds config fixture for GCP provider using ADC (no credentials file). |
| internal/config/testdata/secrets/gcp_provider_missing_project.yml | Adds config fixture validating missing required project. |
| internal/config/testdata/secrets/gcp_provider.yml | Adds config fixture validating explicit credentials file. |
| internal/config/testdata/secrets/all_providers.yml | Adds config fixture enabling file+vault+gcp simultaneously. |
| internal/config/testdata/secret_references.yml | Updates secret reference example to explicitly use gcp provider. |
| internal/config/secrets_test.go | Adds validation and enabled-provider tests for GCP. |
| internal/config/secrets.go | Adds GCPProviderConfig, defaults, validation and EnabledProviders support. |
| internal/config/config_test.go | Adds config load tests covering GCP provider configs and references. |
| go.mod | Adds Secret Manager dependency and updates related Google deps. |
| go.sum | Updates checksums for new/updated dependencies. |
| dagger.json | Bumps Dagger engine version and adds caching configuration flag. |
| config/flipt.schema.json | Adds secrets.providers.gcp JSON schema. |
| config/flipt.schema.cue | Adds secrets.providers.gcp CUE schema and formatting adjustments. |
| cmd/flipt/main_test.go | Adds secret-walking tests for GCP provider references. |
| cmd/flipt/main.go | Adds blank import to register GCP provider factory. |
| build/testing/integration.go | Adds signing/gcp integration test using Secret Manager emulator. |
| build/go.mod | Updates build module deps (Dagger/grpc/gqlgen and related indirects). |
| build/go.sum | Updates build module sums (incl. Dagger/grpc/gqlgen). |
| build/CLAUDE.md | Renames doc title/content to be “AI Agents” guidance. |
| build/AGENTS.md | Adds a stub file pointing to build/CLAUDE.md. |
| AGENTS.md | Adds references to build/integration test structure. |
| .github/workflows/test.yml | Bumps Dagger version and sets DAGGER_NO_NAG. |
| .github/workflows/integration-test.yml | Bumps Dagger version and sets DAGGER_NO_NAG. |
Comments suppressed due to low confidence (1)
build/AGENTS.md:1
build/AGENTS.mdcurrently just contains a path string, which won’t behave like a redirect or symlink in most renderers and is confusing for readers. Either duplicate/move the actual content intobuild/AGENTS.md(and remove/replacebuild/CLAUDE.md), or make this a real symlink if the repo/tooling supports it.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use WithEndpoint/WithoutAuthentication instead of WithGRPCConn for emulator connections to avoid connection ownership issues - Extract secretVersionName/secretParent helpers and test them directly - Add require.True check for factory existence in TestFactory_MissingConfig - Pin GCP Secret Manager emulator to v1.3.0 for reproducible builds Signed-off-by: Mark Phelps <[email protected]>
Add optional `location` config field to the GCP provider. When set,
the provider uses the regional endpoint and location-scoped resource
names (projects/{project}/locations/{location}/secrets/...).
Also includes .gitignore update for docs/plans.
Signed-off-by: Mark Phelps <[email protected]>
- Use pre-built emulator Docker image instead of building from source - Replace deprecated WithCredentialsFile with WithAuthCredentialsFile Signed-off-by: Mark Phelps <[email protected]>
Summary
secrets.providers.gcpwithproject(required) andcredentials(optional) fieldsChanges
internal/coss/secrets/gcp/provider.go: New provider withGetSecret,ListSecrets, andClose. Supports connecting to a GCP Secret Manager emulator viaSECRET_MANAGER_EMULATOR_HOSTenv var for testing.internal/coss/secrets/gcp/provider_test.go: Factory registration, interface compliance, and resource name testsinternal/config/secrets.go: AddedGCPProviderConfig, validation, defaults, andEnabledProviders()supportinternal/config/secrets_test.go: Config validation and enabled providers tests for GCPinternal/secrets/manager.go: GCP provider initialization blockcmd/flipt/main.go: Blank import for GCP provider registrationconfig/flipt.schema.cue/config/flipt.schema.json: Addedgcpprovider to both CUE and JSON schemasgo.mod/go.sum: Updatedcloud.google.com/go/secretmanagerdependencyTesting
Unit Tests
internal/config/config_test.go): GCP provider YAML loading, GCP without credentials (ADC), missing project validation error, all three providers together. Each test runs against both YAML and ENV config sources.internal/config/secrets_test.go): GCP validate, all providers enabled, GCP disabled skips validation.internal/secrets/manager_test.go): Manager creation with GCP provider, manager with all providers (file + vault + gcp), GCP factory not registered error, disabled GCP provider skipped.config/): CUE and JSON schema validation against default config with GCP fields.Integration Tests
signing/gcp(build/testing/integration.go): End-to-end Dagger integration test using blackwell-systems/gcp-secret-manager-emulator as an in-memory gRPC service. Generates a GPG signing key, stores it in the emulator via the real GCP SDK, then runs the signing test suite against Flipt configured with the GCP secrets provider.CI Updates
0.18.19to0.19.11DAGGER_NO_NAG=1to suppress Dagger Cloud nag messagesExample Configuration
Secret references:
${secret:gcp:my-secret/value}