I am currently experimenting with migrating to Gitlab Components, however it seems there are a few things that are not very clear.
I want to be able to use a component, however for the component to run it is necessary that previous jobs are done, like for example I want to scan a container image, but the build and package jobs (not stages, we use stageless) have to be done… how should I define the order with the component… I hacked up a modified component that uses needs: and an input, however this only work for one job, not for a chain of jobs… so for example if the build and package job are done I have no way
include:
- component: gitlab.ecdevops.eu/cc/catalog/simple-component@0.0.3
inputs:
needs: build-18
- component: gitlab.ecdevops.eu/cc/catalog/simple-component@0.0.1
build-20:
image: webmutation/docker-gitlab-build-sonar:node20
cache: {}
dependencies: []
artifacts:
when: always
paths:
- $CI_PROJECT_DIR/build.log
script:
- |
node -v
echo-bella:
image: webmutation/docker-gitlab-build-sonar:node20
script:
- echo "Hello, Bella!"
build-18:
image: webmutation/docker-gitlab-build-sonar:node18
cache: {}
dependencies: []
needs: ["build-20","echo-bella"]
artifacts:
when: always
paths:
- $CI_PROJECT_DIR/build.log
script:
- |
node -v
works fine, but if I want to depend on two jobs instead of one, I am not able to do this, it return invalid
include:
- component: gitlab.ecdevops.eu/cc/catalog/simple-component@0.0.3
inputs:
needs: ["build-18", "build-20"]
- component: gitlab.ecdevops.eu/cc/catalog/simple-component@0.0.1
build-20:
image: webmutation/docker-gitlab-build-sonar:node20
cache: {}
dependencies: []
artifacts:
when: always
paths:
- $CI_PROJECT_DIR/build.log
script:
- |
node -v
echo-bella:
image: webmutation/docker-gitlab-build-sonar:node20
script:
- echo "Hello, Bella!"
build-18:
image: webmutation/docker-gitlab-build-sonar:node18
cache: {}
dependencies: []
needs: ["build-20","echo-bella"]
artifacts:
when: always
paths:
- $CI_PROJECT_DIR/build.log
script:
- |
node -v
In short what I am asking is what is the proper way to plugin a component into the pipeline, and how should artefacts be passed into a component… in a similar way as in a job or is there a special way to do this with inputs