【问题标题】:Job artifacts are not shown未显示作业工件
【发布时间】:2022-06-11 14:27:42
【问题描述】:

我正在使用自托管 gitlab 版本 14.10 和使用 docker 执行器的自注册 gitlab 运行器。在这张图片中,我正在使用 gitlab 的秘密检测作业 template 并生成工件 gl-secret-detection-report.json 并且似乎将其上传回某种协调器(我想知道这是什么)但不幸的是我仍然看不到它在此页面的我的Job artifacts 部分中。

我检查了this 似乎相似的问题,但事实并非如此,我还检查了 GitLab 的文档,没有发现与我的问题相似的内容。

我什至在我的 Pipeline 页面的 Job 列表中看不到 Artifacts 列:

【问题讨论】:

  • 您能否修改您的问题以包含您的.gitlab-ci.yml 文件?

标签: gitlab gitlab-ci gitlab-ci-runner


【解决方案1】:

好的,我找到了答案here

为了能够浏览报告输出文件,请包含 artifacts:paths 关键字。

在我为工作覆盖了工件部分后,它运行良好。 Pipeline 的作业列表页面的作业行中仍然没有“Artifacts”列。

我的.gitlab-ci.yml

variables:
  DOCKER_HOST: tcp://docker:2375
  DOCKER_DRIVER: overlay2
  DOCKER_TLS_CERTDIR: ""

include:
  - project: 'devops/gitlab-templates'
    ref: master
    file: '/lib/gitlab/ci/templates/Docker/Docker-Build-Risky.DO.yml'

  - project: 'devops/gitlab-templates'
    ref: master
    file: '/lib/gitlab/ci/templates/Security/Trivy-Scan.yml'

  - template: Security/Secret-Detection.gitlab-ci.yml

  - project: 'devops/gitlab-templates'
    ref: master
    file: '/lib/gitlab/ci/templates/Security/Dive-Scan.yml'

  - project: 'devops/gitlab-templates'
    ref: master
    file: '/lib/gitlab/ci/templates/Docker/Docker-Retag-n-Push.DO.yml'

  - project: 'devops/gitlab-templates'
    ref: master
    file: '/lib/gitlab/ci/templates/Docker/Docker-Retag-n-Push.AWS.yml'

  - project: 'devops/gitlab-templates'
    ref: master
    file: '/lib/gitlab/ci/templates/Docker/Docker-Retag-n-Push.GCP.yml'

  - project: 'devops/gitlab-templates'
    ref: master
    file: '/lib/gitlab/ci/templates/AWS/Deploy.yml'

secret_detection:
  variables:
    SECRET_DETECTION_HISTORIC_SCAN: "true"
  allow_failure: false
  artifacts:
    reports:
      secret_detection: gl-secret-detection-report.json
    # this is the way to make artifacts appear 
    paths:
      - gl-secret-detection-report.json
    expire_in: 1 day      

integration-tests:
  stage: test
  needs:
    - job: "docker-build"
      artifacts: true
  ...

deploy-to-aws:
  environment: production
  variables:
    ...

【讨论】:

  • @Richard 我认为最好把它放在我的答案中
猜你喜欢
  • 1970-01-01
  • 2019-04-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-06
  • 2014-03-19
  • 2016-06-10
相关资源
最近更新 更多