Implement CI syntax for secrets
What does this MR do?
This new syntax is hidden behind global (instance wide) feature flag named
ci_secrets_syntax, disabled by default.
The syntax look like this:
deploy: stage: release secrets: DATABASE_PASSWORD: vault: production/db/password # translates to secret `kv-v2/data/production/db`, field `password` SSL_PRIVATE_KEY: vault: production/ssl/private-key@ops # translates to secret `ops/data/production/ssl`, field `private-key` S3_SECRET_KEY: # translates to secret `aws/data/production/s3`, field `secret-key` vault: engine: name: kv-v2 path: aws path: production/s3 field: secret-key
Here is a test the cover the above forms of the syntax - https://gitlab.com/gitlab-org/gitlab/-/blob/f5cec6eda06b53be3461ab097a12e68278653750/ee/spec/lib/gitlab/ci/config/entry/job_spec.rb#L60-106.
The processed config will be returned to the runner (to be implemented in a subsequent MR) where it will be used to fetch the secrets from Vault, see gitlab-runner!2006 (closed).
This will be GitLab Premium feature, the license check will be added in a subsequent MR at the API level so that we can scope to a project.
In this case
vault is a static keyword that represents the secrets provider type. While it will allow us to add another type of provider in the future, it prevents us to have multiple providers of the same type, for example
ops-vault, etc, something that was supported with the syntax implemented in !31831 (closed).
ci_secrets_syntax feature flag disabled
ci_secrets_syntax feature flag enabled
Does this MR meet the acceptance criteria?
- Changelog entry
- Documentation (if required)
- Code review guidelines
- Merge request performance guidelines
- Style guides
- Database guides
- Separation of EE specific content
Availability and Testing
- Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
- Tested in all supported browsers
- Informed Infrastructure department of a default or new setting change, if applicable per definition of done
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
Label as security and @ mention
- The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- Security reports checked/validated by a reviewer from the AppSec team