Downstream pipeline can not be created, Reference not found

I have a repo on gitlab.com with a .gitlab-ci.yml that has an include for a file in another repo:

---
variables:
  BUILD_ARM64: 1

include:
  - project: 'pipeline-components/org/config'
    ref: v2.0.10
    file: pipeline.yml

The included pipeline.yml file has the following job that triggers another pipeline:

deploy documentation:
  stage: documentation
  allow_failure: true
  trigger:
    project: pipeline-components/org/pipeline-components.dev
    branch: $CI_DEFAULT_BRANCH
  rules:
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'

However, when the pipeline runs, the job fails, with the message:

Downstream pipeline can not be created, Reference not found

I think I have everything set up correctly (i.e the reference pipeline-components/org/pipeline-components.dev/-/blob/master/.gitlab-ci.yml does exists) , but obviously something is wrong.

The issue can be seen at, for instance, Pipeline #1950221658 · pipeline-components / snyk · GitLab.

I have searched online for the error message, but other than an apparently unreated issue, I couldn’t find anything.

Can someone help me figure out what is the cause of the failure and how to fix it?

Hi,

What is the name of your default branch?

@paula.kokic I think is on the right track:

Given:

deploy documentation:
  stage: documentation
  allow_failure: true
  trigger:
    project: pipeline-components/org/pipeline-components.dev
    branch: $CI_DEFAULT_BRANCH

CI_DEFAULT_BRANCH is the name of the default branch in the current project, and might not be the name of the default, or any, branch in the trigger project. Change “branch:” to a known branch in pipeline-components.dev.

1 Like

@paula.kokic / @GreenZombie76 Looks like that is the issue.

The default branch for the calling repo is main, but the default branch for both the included and the triggered repo is master.

If $CI_DEFAULT_BRANCH is the default branch of the calling repo, that’s not going to work.

Looks like I’ll either have to move the triggered repos to main as well, or hard-code master to resolve the issue.

1 Like

@potherca Note that trigger:branch is optional, and defaults to the default branch of the target project (see the docs), so you may be able to just remove it.

2 Likes