Description
The envDockerSecrets field in Harness CI Build and Push steps currently supports referencing environment variable names to pass secrets securely to BuildKit.
However, plugin and step output expressions (for example, <+execution.steps.STEP_ID.output.outputVariables.VAR_NAME>) cannot be referenced directly in envDockerSecrets.
This limits the ability to use dynamically generated credentials directly within the field.
Current Behavior
When a pipeline generates a secret dynamically during execution, the output expression cannot be used directly as the value of an envDockerSecrets entry.
Instead, the output must first be assigned to an environment variable in the Build and Push step. The envDockerSecrets field then references that environment variable by name.
For example:
envVariables:
BUILDKIT_TOKEN: <+execution.steps.GENERATE_TOKEN.output.outputVariables.TOKEN>
envDockerSecrets:
TOKEN: BUILDKIT_TOKEN
This is the currently supported configuration, but it introduces an additional mapping that can make pipeline definitions more complex, particularly when using reusable or matrix-based templates.
Expected Behavior
Allow envDockerSecrets to resolve Harness step and plugin output expressions directly, without requiring an intermediate environment variable assignment.
For example:
envDockerSecrets:
TOKEN: <+execution.steps.GENERATE_TOKEN.output.outputVariables.TOKEN>
The resolved value should continue to be passed securely to BuildKit through its secret-mount mechanism, without exposing the credential through Docker build arguments or logs.
Use Cases
Pipelines frequently generate short-lived credentials during execution, including:
  • GitHub App installation tokens generated by plugin steps.
  • Cloud provider credentials obtained through OIDC exchanges.
  • Ephemeral credentials issued by external secret management systems.
Supporting direct expression resolution would simplify the secure consumption of these credentials during container image builds.
This would be particularly beneficial for reusable pipeline templates and matrix-based executions, where additional environment variable mappings increase configuration complexity and maintenance overhead.
Requested Enhancement
Extend envDockerSecrets expression handling to support direct resolution of step and plugin output variables while preserving the existing BuildKit secret-mount behavior and security protections.
Created by Pedro Mastelaro
·