0

I'm trying to build a docker image as a part of my project's pipeline and pass some credentials as secrets. The compromised line is

DOCKER_BUILDKIT=1 docker build --secret id=ARTIFACTORY_USERNAME --secret id=ARTIFACTORY_PASSWORD -f "$DOCKERFILE" context

I'm getting the following error

could not parse secrets: [id=ARTIFACTORY_USERNAME id=ARTIFACTORY_PASSWORD]: failed to stat ARTIFACTORY_USERNAME: stat ARTIFACTORY_USERNAME: no such file or directory

The strange thing is that this works in the same machine where Jenkins executes it if I execute it manually.

Is there something that Jenkins does between starting the execution and reaching the script that could be messing with this?

Manuel Mena
  • 121
  • 2
  • 8

1 Answers1

0

Sounds like Jenkins agent doesn't have the Environment Variables set. You could do a printenv or an echo to check this in your pipeline.

But it is worth checking around your logic that sets these env vars in the pipeline.

apr_1985
  • 1,764
  • 2
  • 14
  • 27