首页 > 解决方案 > 禁止从协调器下载工件

问题描述

我正在使用 gitlabci 构建一个 jar 应用程序,构建完成后,该 jar 被发送到带有工件的下一个任务。

Mavenbuild:artifact:
stage: mavenbuild
  image:
    name: maven:3.6.0-jdk-8
  tags:
    - docker
  script:
    - mvn clean install -pl batch-o365 -am -q
  artifacts:
    paths: 
      - batch-o365/app

Dockerbuild:ok:
  stage: dockerbuild
  image:
    name: ekino/docker-buildbox:latest-dind-aws
  dependencies:
    - Mavenbuild:artifact
  tags:
    - docker
  script:
    - docker build .

工件很好上传:

Uploading artifacts...
batch-o365/app: found 3 matching files             
Uploading artifacts to coordinator... ok            id=11969 responseStatus=201 Created token=xxx

但是当我在下一个任务中绑定它时,我遇到了这个错误:

Downloading artifacts for Mavenbuild:artifact (11969)...
ERROR: Downloading artifacts from coordinator... forbidden  id=11969 responseStatus=403 Forbidden status=403 Forbidden token=xxx
FATAL: permission denied                           
ERROR: Job failed: exit code 1

我已经在这个 gitlab 服务器的另一个项目上使用了工件,并且运行良好。

这里有人已经对工件有这个问题了吗?

标签: gitlab-ci

解决方案


我找到了解决方案。

我们正在使用内部代理,我忘记排除 gitlab URL。

通过此修改:

Dockerbuild:ok:
  stage: dockerbuild
  image:
    name: ekino/docker-buildbox:latest-dind-aws
  variables:
    HTTP_PROXY: http://proxy:8000
    HTTPS_PROXY: http://proxy:8000
    NO_PROXY: 169.254.169.254,gitlab.xxx.com

工件很好地被工作回收。

Downloading artifacts for Mavenbuild:artifact (11989)...
Downloading artifacts from coordinator... ok        id=11989 responseStatus=200 OK token=--xxx

推荐阅读