Home > Software engineering >  Concourse put task into docker-image resource. Build_args are not passed to Dockerfile
Concourse put task into docker-image resource. Build_args are not passed to Dockerfile

Time:05-10

I have a case when the following Concourse pipeline build_args are not used/passed to docker build phase. The pipeline looks like below one:

 name: project
  type: git
  check_every: 1m
  source:
    uri: ((project-url))
    branch: ((project-branch))
    private_key: ((github-private-key))
    paths: [ ((context))/* ]

- name: registry
  type: docker-image
  source:
    username: ((art_user))
    password: ((art_token))
    repository: docker.artifactory......

... ...

jobs:

- name: publish
  serial: true
  plan:
  - in_parallel:
    - get: project
     ... ...
  - put: build
    resource: registry
    params:
      build: project/((context))
      build_args:
        a_user: ((art_user))
        a_token: ((art_token))
        testArg: "testing"

Dockerfile in the context directory has the following content. I remove any specifics from it.

FROM docker.artifactor.../debian:buster

#####################

ARG a_user
ARG a_token
ARG testArg
RUN echo "a_user: $a_user"
RUN echo "a_token: $a_token"
RUN echo "testArg: $testArg"
RUN env

Issue is these variables have empty values during build time. Below is a sample run:

Status: Downloaded newer image for docker.artifactory..../debian:buster
 ---> 26a2b081e032
Step 4/38 : ARG a_user
 ---> Running in 6d48933458d9
Removing intermediate container 6d48933458d9
 ---> d2913609be9e
Step 5/38 : ARG a_token
 ---> Running in 1b94c1795d8c
Removing intermediate container 1b94c1795d8c
 ---> 8bc2f65677ca
Step 6/38 : ARG testArg
 ---> Running in 88c088363349
Removing intermediate container 88c088363349
 ---> 810a481ad166
Step 7/38 : RUN echo "a_user: $a_user"
 ---> Running in 901423ea11b6
a_user: 
Removing intermediate container 901423ea11b6
 ---> 58e18ab30dbc
Step 8/38 : RUN echo "a_token: $a_token"
 ---> Running in 95e9239bbceb
a_token: 
Removing intermediate container 95e9239bbceb
 ---> ce2df5ea1a36
Step 9/38 : RUN echo "testArg: $testArg"
 ---> Running in 7443e6da424e
testArg: 
Removing intermediate container 7443e6da424e
 ---> 46ab83d6f94f
Step 10/38 : RUN env
 ---> Running in 4f780b89f7ee
no_proxy=...
HOSTNAME=1f790b89f7ea
HOME=/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/

Could you please help here.

CodePudding user response:

The pipeline you pasted has been edited down too heavily for me to put a finger on exactly what's wrong, but one thing I notice is that the image resource is named 'registry' but the put refers to the build resource (?!). The registry is referenced by a resource param, enter image description here

  • Related