Waiting for jobs in detached pipeline

Replace this template with your information

I am wondering if it is possible to get artifacts in a detached pipeline?
What I am trying to do is setup a pipeline with the following steps.

  • Test
  • Analyze

Analyze should only happen when a merge request is opened as it posts the analysis in the merge request. It requires an artifact from the test stage. Since Analyze only happens on merge_requests it runs in a detached pipeline and it
A. Does not have access to artifacts from Test
B. Does not wait for Test to finish

Is there a way to have a stage run only when a merge_request opens but it not be in a detached state? Or is there a way that if it is in a detached state can it wait for the previous stage to finish and get the artifact from that.

This is a self managed gitlab instance running the free community edition.

Here is how my gitlab ci is currently.

stages:
  - test
  - analyze

rspec:
  script: "bundle exec rspec --fail-fast"
  stage: test
  artifacts:
     paths:
      - artifacts
    expire_in: 1 week

sonar:
  image:
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [""]
  stage: build
  only:
    - merge_request
  dependencies:
    - rspec
  script:
    - sonar-scanner -Dsonar.qualitygate.wait=true
2 Likes

@timothyjosefik have you found a solution to this?

I am having the same situation. Detached pipeline… I can see my artifacts get uploaded but during the artifacts download phase nothing arrives to the dependant job.

Under https://docs.gitlab.com/ee/ci/caching/ I found that

:’(