How can I pass artifacts from jobs in parent pipeline if some of jobs are failed?
There is my 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
If some of jobs fails, job upload-patient-report can't start with error:
This job could not start because it could not retrieve the needed
artifacts.
Maybe you know the way how can i get artifacts in child pipeline without needs? 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't work in CI, i dont know why, i just got 404 error. But in CLI artifact is download