I've been trying for a day now to create a multiple pipeline with Gitlab-CI CE (community edition) version 16.5 and to pass the artifact from the upstream project to the downstream project without any success. I tried to paste here info that's help:
upstream gitlab-ci.yml file
stages:
- generate
- trigger
default:
image: alpine:3.14
tags:
- docker
generate-artefact: # This job also runs in the test stage.
stage: generate # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 10 seconds." >> arti.txt
- sleep 10
- echo "No lint issues found."
artifacts:
untracked: false
when: on_success
expire_in: 1 days
paths:
- "arti.txt"
trigger-job: # This job runs in the deploy stage.
stage: trigger
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
trigger:
project: sandbox/downstream
branch: main
forward:
pipeline_variables: true
downstream gitlab-ci.yml file
default:
image: alpine:3.14
tags:
- docker
build_job:
stage: build
script:
- ls -lhR
needs:
- project: sandbox/upstream
job: generate-pipeline
ref: main
artifacts: true
So nothing special, I'm going to create a file on the first upstream job and the second one is to trigger the downstream project to use the artefact that is generated. But when I try the needs:project directives in my yaml, the gitlab auto-yaml check displays an error message that the type is incorrect for the needs directives.
So the pipeline just fail at start because yaml is invalid.
So the pipeline just fails at startup. Because yaml is invalid.
I tried to use needs:pipeline but as far as I understand, this directive is for parent/child pipeline, I mean everything in the same project...
I red some gitlab topics that say that the version of the gitlab instance is in cause, this directive is reserved for premium version, but when I look on the official documentation it says "all offerings" for needs:projects.
The downstream project is on the "access-token-scope" of the upstream project, so it can access it.
If you need more infos, tell me what you need, thanks for support :)