Condition with Repo is not working

Hi guys,
I need your support, I’m using downstream plugin to trigger build from other repo, (both are implemented with Drone CI), I’m trying filtering the step I want to call by repo (the name of repo B which triggers Repo A) but this is not working

I’m trying filtering the step I want to call by repo (the name of repo B which triggers Repo A) but this is not working

this is not how the repo condition works.

the main use case for the repository condition is when you fork a repository and you have Drone enabled for the repository and its fork. You may (for example) want to skip certain steps if the repository is a fork. For this, you would use the repo condition.

kind: pipeline
type: docker
name: default

steps:
- name: build
  image: golang
  commands:
  - go build
  when:
    repo:
    - ashwilliams1/drone  # only run this step for my fork

- name: deploy
  image: plugins/docker
  settings: ...
  when:
    repo:
    - drone/drone # only run this step for the main repo
1 Like

Yes, I did this for this purpose but not working.
Thanks a lot for your support.

here is a sample yaml to demonstrate:

and here is the resulting build: https://cloud.drone.io/drone/hello-world/214/1/2

The above yaml and resulting pipeline demonstrate how the feature works as expected. The first step (test1) does not execute because the repository for which the pipeline is executing does not match the when condition. The second step (test2) executes because the repository for which the pipeline is executing does match the repository in the when condition.

1 Like

Can I trigger specific pipeline from downstream, If I have two pipelines, so that one pipeline has only the stage I want to execute from the other repo?

@bradrydzewski how to use the params in repo, to add condition in the other repo:
for example I use this
params:
- BE=true
and I want to add condition in the other repo, If BE=false skip this step

no, this capability does not exist.

1 Like

I use if $BE=false exit 78 but this exists all the remaining steps, if there other code to exit only one step?

you can use exit 0 to exit the step without failing and without skipping remaining steps.

1 Like