Interview Prep/Jenkins/Plugins, JCasC & Jenkins on Kubernetes

How do you inject secrets into JCasC without committing them?

AdvancedConceptPlugins, JCasC & Jenkins on Kubernetes
Answer

JCasC resolves ${VAR} placeholders from, in order, secret sources: environment variables, files in /run/secrets (Docker/Kubernetes secrets, filename = variable name), and plugins for Vault, AWS Secrets Manager or Kubernetes. ${VAR:-default} provides a default.

credentials:
  system:
    domainCredentials:
      - credentials:
          - string:
              id: sonar-token
              scope: GLOBAL
              secret: "${SONAR_TOKEN}"

Use ^${VAR} to escape a literal ${...} that must not be resolved.

All Jenkins questions Roadmap: Jenkins

More on Plugins, JCasC & Jenkins on Kubernetes