【问题标题】:Files removed during pipeline在管道期间删除的文件
【发布时间】:2021-04-11 01:36:36
【问题描述】:

我正在尝试运行此管道:

stages:
  – build
  – deploy

get_packer:
  stage: build
  artifacts:
    paths:
    – packer
  script:
    – echo "Fetching packer"
    – wget https://releases.hashicorp.com/packer/1.5.5/packer_1.5.5_linux_amd64.zip -O packer.zip
    - unzip -o packer.zip -d packer
    - cd packer
    - chmod +x packer

deploy_centos-7:
  stage: deploy
  script:
    – echo "Deploying CentOS 7"
    – cd packer
    – ./packer build centos/centos-7.json

阶段构建成功完成,但我在部署阶段得到了这个:

Reinitialized existing Git repository in /home/gitlab-runner/builds/c04fe5cf/0/project/pak/.git/
Checking out 43dsq6aa as refs/merge-requests/3292/head...
Removing packer.zip
Removing packer/packer

显然失败了,因为

./packer: No such file or directory

我不明白为什么从构建中获取的这些文件会被删除?

【问题讨论】:

标签: gitlab-ci


【解决方案1】:

GitLab 正在清理两个后续作业之间的工作目录。这就是为什么您必须使用artifactsdependencies 在作业之间传递文件的原因。

stages:
  – build
  – deploy

get_packer:
  stage: build
  artifacts:
    paths:
    – packer
  script:
    – echo "Fetching packer"
    – wget https://releases.hashicorp.com/packer/1.5.5/packer_1.5.5_linux_amd64.zip -O packer.zip
    - unzip -o packer.zip -d packer
    - cd packer
    - chmod +x packer

deploy_centos-7:
  stage: deploy
  dependencies:
    - build
  script:
    – echo "Deploying CentOS 7"
    – cd packer
    – ./packer build centos/centos-7.json

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-31
    • 2010-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多