Search code examples
jenkinsjenkins-job-buildercontainer-registry

Passing auth key to a container registry in Jenkins Job builder


I am trying to push a built docker container to a private registry and am having difficulty understanding how to pass the key safely and securely. I am able to successfully connect and push my container if I "build with parameters" in the Jenkins UI and just paste in my key.

This is my yaml file, and my templates to take care of most other things:

- project:
  name: 'merge-monitor'
  github_project: 'merge-monitor'
  value_stream: 'enterprise'
  hipchat_rooms:
    - ''
  defaults: clojure-project-var-defaults

  docker_registry: 'private'
  jobs:
    - '{value_stream}_{name}_docker-build': # build docker images
    wrappers:
      - credentials-binding:
      - text:
        credential-id: our-credential-id
        variable: DOCKER_REGISTRY_PASSWORD

I have read through the docs, and maybe I am missing something about credentials-binding, but I thought I simply had to call what key I had saved in Jenkins by name, and pass key as a variable into my password

Thank you in advance for the help


Solution

  • The issue here was completely different than what I was searching. Here, we simply needed to give our worker permissions within our own container registry as a user before it would have push access