我已经在这一方面敲打了一段时间,我无法弄清楚(我知道这一定是一件简单的事情)。
当前,我要做的是从两个存储库中提取(自然会创建两个单独的目录),然后我试图将文件从一个目录移至另一个目录以成功地执行DockerFile。
这是我的pipeline.yml文件的样子:
---
jobs:
- name: build-nexus-docker-image
public: false
plan:
- get: git-nexus-docker-images
trigger: true
- get: git-nexus-license
trigger: true
- task: mv-nexus-license
config:
platform: linux
image_resource:
type: docker-image
source: {repository: ubuntu, tag: "trusty"}
inputs:
- name: git-nexus-license
- name: git-nexus-docker-images
run:
path: /bin/sh
args:
- -c
- mv -v git-nexus-license/nexus.lic git-nexus-docker-images/nexus.lic; ls -la git-nexus-docker-images
- put: nexus-docker-image
params:
build: git-nexus-docker-images/
resources:
- name: git-nexus-docker-images
type: git
source:
uri: git@git.company.com:dev/nexus-pro-dockerfile.git
branch: test
paths: [Dockerfile]
private_key: {{git_ci_key}}
- name: git-nexus-license
type: git
source:
uri: git@git.company.com:secrets/nexus-information.git
branch: master
paths: [nexus.lic]
private_key: {{git_ci_key}}
- name: nexus-docker-image
type: docker-image
source:
username: {{aws-token-username}}
password: {{aws-token-password}}
repository: {{ecr-nexus-repo}}
我已经发布了实际上可以部署到大厅的管道;但是我尝试了很多事情,但是我不知道该怎么做。我陷入了将许可证文件从git-nexus-license
目录转移到git-nexus-docker-images
目录的部分。我所做的似乎没有用于nexus.lic
文件,因为当构建Docker映像时,它失败了,因为它无法在目录中找到该文件。
编辑:我成功地使用上面的代码可以成功地" MV" nexus.lic
,但是由于找不到文件,该构建仍失败了!我不确定我在做什么错,如果我手动进行操作,则构建可以正常工作,但是在大厅时,构建失败了。
好吧,所以我弄清楚了我在做错什么,而且像往常一样,这很小。我忘了将outputs
添加到YML文件中,该文件告诉Concourse这是新的WorkDir。现在的样子(对我有用):
---
jobs:
- name: build-nexus-docker-image
public: false
plan:
- get: git-nexus-docker-images
trigger: true
- get: git-nexus-license
trigger: true
- task: mv-nexus-license
config:
platform: linux
image_resource:
type: docker-image
source: {repository: ubuntu, tag: "trusty"}
inputs:
- name: git-nexus-license
- name: git-nexus-docker-images
outputs:
- name: build-nexus-dir
run:
path: /bin/sh
args:
- -c
- mv -v git-nexus-license/nexus.lic build-nexus-dir/nexus.lic; mv -v git-nexus-docker-images/* build-nexus-dir; ls -la build-nexus-dir;
- put: nexus-docker-image
params:
build: build-nexus-dir/
resources:
- name: git-nexus-docker-images
type: git
source:
uri: git@git.company.com:dev/nexus-pro-dockerfile.git
branch: test
paths: [Dockerfile]
private_key: {{git_ci_key}}
- name: git-nexus-license
type: git
source:
uri: git@git.company.com:secrets/nexus-information.git
branch: master
paths: [nexus.lic]
private_key: {{git_ci_key}}
- name: nexus-docker-image
type: docker-image
source:
username: {{aws-token-username}}
password: {{aws-token-password}}
repository: {{ecr-nexus-repo}}
我希望这可以帮助任何人陷入困境。:)