Concourse将任务放入Docker-Image资源中。 build_args尚未传递给Dockerfile
当以下大厅管道build_args未使用/传递到docker build阶段时,我有一个情况。管道在下面的一个:
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在上下文目录中具有以下内容。 我从中删除了任何细节。
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
问题是这些变量在构建时间期间具有空值。 以下是示例运行:
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=/
您能在这里提供帮助吗?
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您粘贴的管道已被严重编辑,以至于我完全无法解决问题,但是我注意到的一件事是图像资源被命名为“注册表”,但提照是指
build> build> build
资源(?!)。注册表
由资源
param引用,这似乎不是合法的参数。追溯您的步骤。使用以下最小可行管道设置作为指导:
给定以下Dockerfile,请
code-repo/docker/dockerfile
和一个最小管道,如下所示:
我会看到我的
hello 在构建中构建ARG:

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 (?!). Theregistry
is referenced by aresource
param, which doesn't seem to be a legit param.Retrace your steps. Use the following minimal viable pipeline setup as a guide:
Given the following dockerfile at
code-repo/docker/Dockerfile
and a minimal pipeline that looks as follows:
I am getting seeing my

HELLO
build arg in the build: