Gitlab Secrets
Gitlab secrets can be managed with GitlabSecrets
Configuring Gitlab credentials
import org.ysb33r.gradle.iac.base.secrets.GitlabSecrets
terraform { (1)
secrets {
gitlabMaintainer(GitlabSecrets) { (2)
useGitlabToken('1234567890') (3)
useGitlabTokenFromEnvironment() (4)
}
}
sourceSets {
main {
fromSecretsProvider(terraform.secrets.gitlabMaintainer) (5)
}
}
}
1 | Replace terraform with opentofu for OpenTofu. |
2 | Declare a set of Gitlab secrets. |
3 | Declare a Gitlab token. Use anything convertible to a string. Providers are recommended. |
4 | Use the GITLAB_TOKEN environment variable of the gitlab.token system/Gradle property. |
5 | Place the correct environment variables at the time the tool executes. |