docker-image-resource icon indicating copy to clipboard operation
docker-image-resource copied to clipboard

Support Secrets in Build

Open starpebble opened this issue 5 years ago • 8 comments

Issue: Support docker secret, in concourse jobs that build docker images.

Reference:

docker build has a --secret command line argument. It's different than --build-arg https://docs.docker.com/engine/reference/commandline/build/

Expected result: A concourse job can pass a map of secrets to the a job. Just like build-args.

Motivation: Secrets will not show up in docker inspect. build-args will show up in docker inspect. secrets are safe for passwords. build-args are not safe for passwords.

Concourse credential protected values must be valid values for a secret. Then everything is safe.

docker build --secret is supported in: Docker API 1.39+

Example:

build_args:
  DO_THING: true
  HOW_MANY_THINGS: 2
  EMAIL: [email protected]
  CI_BUILD_ID: concourse-$BUILD_ID
secrets:
  PASSWORD: {{secret_password}}

starpebble avatar Mar 29 '19 20:03 starpebble

Does anyone know if there is a workaround for this (before this issue is addressed) or is it currently not possible to supply a secret?

stec00 avatar Oct 13 '21 14:10 stec00

there is no way to supply a secret now. PR is welcome as docker_buildkit is already an option.

xtremerui avatar Oct 13 '21 18:10 xtremerui

Bump!

JasonDictos avatar Apr 03 '24 22:04 JasonDictos

Related: https://github.com/concourse/docker-image-resource/pull/331

JasonDictos avatar Apr 03 '24 23:04 JasonDictos

I am working on a fix here: https://github.com/concourse/docker-image-resource/pull/363

JasonDictos avatar Apr 08 '24 18:04 JasonDictos

I understand this is done as of https://github.com/concourse/docker-image-resource/pull/366.

However, I can't quite figure our how to use it. Say I've got access to ((super-token)) through my vars. How would I provide that to the build of an image through secrets:? It's probably obvious but I fail to connect the dots.

mamachanko avatar May 02 '24 13:05 mamachanko