A
A
akdes2020-03-11 14:11:04
Continuous Integration
akdes, 2020-03-11 14:11:04

Gitlab CI building two applications with common stages and dependencies that do not slow down each other?

Hi all.
There is a monorepo with an angular project - a monorepo is when several products are developed in one repository.
When a release comes out, you need to build 2 applications at the moment - npm install, ng build, docker build for each

There is a gitlab-ci.yml file and two phases: buildng and builddocker (actually more, but it doesn’t matter here)
in the first a couple of file manipulations take place and the application is built (ng build)
in the second, the docker image is built and pushed.

since there are two applications, there are also two “jobs” for each phase:

stages:
   - buildng
   - builddocker

buildng_app1:
   stage: buildng
   allow_failure: false
   ...
   script: 
       - do the job for app1

buildng_app2:
   stage: buildng
   allow_failure: false
   ...
   script: 
       - do the job for app2

builddocker_app1:
   stage: builddocker
   allow_failure: false
dependencies:
   - buildng_app1
   ...
   script: 
       - do the job for app1

builddocker_app2:
   stage: builddocker
   allow_failure: false
dependencies:
   - buildng_app2
   ...
   script: 
       - do the job for app2


Everything would be fine, it works fine ... But, if for some reason buildng_app1 or 2 crashes, the process stops for everything.
What I need is that if, for example, buildng_app1 "broke", then buildng_app2 and builddocker_app2 continued their work, but builddocker_app1 did not, because. its buildng_app1 dependency didn't survive.
As a possible solution, set allow_failure: true, but then builddocker_app1 will still run.

Any ideas?

Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
akdes, 2020-03-16
@akdes

Answer: use needs instead of dependencies.
https://habr.com/ru/company/flant/blog/491888/
Gitlab update, the first feature described on Habré solves my problem - more than ever, on time! :D

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question