averri
July 25, 2016, 10:30am
1
I would like to create multiple jobs for build stage, but being able to run them sequentially, example:
stage 1: build Java artifact.
stage 2: build a Docker image and push to registry.
Both are build stages, but they run in parallel if specifying:
build_java:
stage: build
script:
- mvn clean package -P production -T 2C
build_docker:
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker build -t $IMAGE_NAME .
- docker push $IMAGE_NAME
How to execute the stages above sequentially?
brad
September 28, 2016, 5:53pm
2
You would need to put them in separate stages, the one running after the other. Jobs in a single stage run in parallel.
Actually, DAG is way over-complicated for your needs. You just need to remove the stage: build
property from both jobs and they should be run in sequential order.
I WAS WRONG - just checked
This is what you need
stages:
- build:jvm
- build:docker
build_java:
stage: build:jvm
script:
- mvn clean package -P production -T 2C
build_docker:
stage: build:docker
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker build -t $IMAGE_NAME .
- docker push $IMAGE_NAME
WTF I just realized what a necro-post this is! @l4-eisenreich why would you reply to a 3-year old post?
I was searching for gitlab ci run jobs sequentially
and the first item was this. So now the next one who is searching for the same topic, has a answer with the appropriate doc.
Ofc, I can delete my post… I do already have the answer