[英]Gitlab runner fails to start. This job is stuck because you don't have any active runners online with any of these tags assigned to them: ios
[英]Gitlab: artifacts don't pass to child pipeline if job fails
如果某些作业失败,如何从父管道中的作业传递工件?
有我的 CI:
.run-tests:
image: maven-allure:jdk-15
before_script:
- apt-get update && apt-get install -y gettext-base
- envsubst < ci-settings.xml > settings.xml
artifacts:
name: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}"
paths:
- mvn_log*
- target*
expire_in: 3 days
when: always
tags:
- k8s
smoke-tests:
stage: smoke tests
extends:
- .run-tests
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "push"
when: never
- if: $CI_PIPELINE_SOURCE == "web"
when: always
script:
- *smoke-tests
sanity-tests:
stage: sanity tests
extends:
- .run-tests
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "push"
when: never
- if: $CI_PIPELINE_SOURCE == "web"
when: always
script:
- *sanity-tests
patient-api-tests:
stage: api tests
extends:
- .run-tests
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "push"
when: never
- if: $CI_PIPELINE_SOURCE == "web"
when: manual
variables:
TELEGRAM_USER_ID: "xxxx"
script:
- *patient-api-tests
needs: []
patient-api-tests-trigger:
stage: trigger jobs
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "push"
when: never
- if: $CI_PIPELINE_SOURCE == "web"
when: always
needs: ["patient-api-tests"]
trigger:
include: .trigger-ci.yml
strategy: depend
forward:
yaml_variables: true
pipeline_variables: true
variables:
PARENT_JOB_NAME: $CI_JOB_NAME
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
.upload-report:
image: maven-allure:jdk-15
variables:
TELEGRAM_USER_ID: "xxx"
script:
- apt-get update && apt-get install -y gettext-base jq curl
- envsubst < ci-settings.xml > settings.xml
- cp -f settings.xml /usr/share/maven/conf/settings.xml
- mkdir -p target/allure-results
- mv target_*/allure-results/* target/allure-results
- mvn allure:report
- date
- sh upload.sh
tags:
- k8s
upload-sanity-smoke-report:
extends: .upload-report
stage: upload smoke sanity report (on failed)
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_PIPELINE_SOURCE == "web"
when: always
allow_failure: true
needs: ["smoke-tests", "sanity-tests"]
upload-patient-report:
extends: .upload-report
stage: upload api report (always)
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_PIPELINE_SOURCE == "parent_pipeline" && $PARENT_JOB_NAME == "patient-api-tests-trigger"
when: always
before_script:
- echo $PARENT_PIPELINE_ID
needs:
- pipeline: $PARENT_PIPELINE_ID
job: sanity-tests
- pipeline: $PARENT_PIPELINE_ID
job: smoke-tests
- pipeline: $PARENT_PIPELINE_ID
job: patient-api-tests
如果某些作业失败,作业上传患者报告无法以错误开始:
This job could not start because it could not retrieve the needed
artifacts.
也许您知道如何在不需要的情况下在子管道中获取工件? I already tried to curl API artifacts by link like: https://gitlab.ru/api/v4/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_COMMIT_REF_NAME}/download?job=smoke-tests And that way don '不能在 CI 中工作,我不知道为什么,我刚刚收到 404 错误。 但在 CLI 工件是下载
通过拥有图形管道,我也遇到了这个问题。 但是,如果不指定needs
关键字,在这种情况下就无法传递工件。
您可以为needs
项目指定optional
参数。
needs:
- job: "jobname"
pipeline: $PARENT_PIPELINE_ID
optional: true
您还可以通过将父管道配置为 (1) 在触发子管道之前完成所需的作业和 (2)指定artifacts:when:
使上游作业always
为来帮助确保作业可以检索工件。
另请参阅文档,特别注意 [un] 支持的场景(例如,合并结果管道不支持此功能)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.