I use a cross project pipeline to publish a Helm chart using GitLab pages.
I have the following GitLab CI job in appsemble/appsemble:
publish helm:
needs:
- helm package
stage: publish
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
VERSION: $CI_COMMIT_TAG
rules:
- if: $CI_COMMIT_TAG
trigger:
project: appsemble/charts
strategy: depend
The helm package
job runs fine.
This triggers the following pipeline in appsemble/charts:
stages:
- test
- build
- deploy
git:
image: alpine
stage: build
rules:
- if: $PARENT_PIPELINE_ID
needs:
- pipeline: $PARENT_PIPELINE_ID
job: helm package
artifacts: true
script:
- apk add git gnupg
- gpg --import "$GPG_PRIVATE_KEY"
- git config commit.gpgSign true
- git config user.email bot@appsemble.com
- git config user.name Appsemble
- git add .
- git commit --message "Add Appsemble Helm chart $VERSION"
- git push origin main --push-option ci.skip
pages:
image: dtzar/helm-kubectl:3
stage: build
rules:
- if: $CI_COMMIT_BRANCH == 'main'
script:
- helm repo index public
artifacts:
paths:
- public
The CI output can be seen here. The git job output shows:
I also tried adding project: appsemble/appsemble
to the needs
section, but that make GitLab CI lint fail with the following message:
jobs:git:needs:need config contains unknown keys: pipeline
jobs:git:needs:need ref should be a string
jobs:git:needs:need ref can't be blank
How do I fix this, so I the downstream CI job in appsemble/charts
uses the job artifacts of an earlier stage in its parent pipeline in appsemble/appsemble
?