0

I'm not sure this is the way to proceed, but I'm starting using downstream pipelines.
I have 3 projects :

  • Project A : web-frontend-1
  • Project B : web-frontend-2
  • Project C : global-e2e-testing

I'm setting up a CI pipeline on Project C which should do :

  • Run main pipeline of Project A, with var TESTING=true (that is building docker images)
  • Run main pipeline of Project B, with var TESTING=true (that is building docker images)
  • Deploy on testing environment (it's pulling docker images, and relaunching project)
  • Run e2e tests on testing environment

Here is my Project C .gitlab-ci.yml (upstream pipeline) :

stages:
- build-testing
- deploy
- test

build-project-a-testing:
  stage: build-testing
  trigger:
    project: workspace/project-a
  variables:
    TESTING: true

build-project-b-testing:
  stage: build-testing
  trigger:
    project: workspace/project-b
  variables:
    TESTING: true

deploy-testing:
  stage: deploy
  tags: ["testing-runner"]
  script:
    - echo "deploying..."

playwright-firefox:
  stage: test
  before_script:
    - npm i
    - npx playwright install
  script:
    - npx playwright test --project=firefox --workers=1
  tags:
    - run-playwright
  artifacts:
    name: playwright-report-firefox
    paths:
      - playwright-report
      - results.xml
    reports:
      junit: results.xml
    expire_in: 1 week
    allow_failure: true

The issue I have is that the downstream pipeline are launched but without waiting them for ending.
So deployment job, would deploy an old container image, and testing is not relevant.

Is there a way to wait for downstream pipeline to finish ?
I can "reverse" the order of which project is downstream / upstream, but since I have two projects to build, the issue would be the same.

1 Answer 1

1

The strategy keyword is the solution :

From the documentation :

trigger_job:
  trigger:
    include: path/to/child-pipeline.yml
    strategy: depend

In this example, jobs from subsequent stages wait for the triggered pipeline to successfully complete before starting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.