[SOLVED] Run docker pipeline after failed exec pipeline

Hey, I’m rather new to Drone but so far really like working with it!

For one project we’re using an exec pipeline for E2E tests because it needs to set up a docker-compose environment. The test framework automatically creates videos and other output files (which are useful for debugging) that need uploading to an external server in a separate step.

This uploading step should be done using a docker container, so I created a second “normal” pipeline that depends_on the first exec pipeline. The problem I have now is that the 2nd pipeline gets skipped whenever the first pipeline fails, however failure of the 1st pipeline would make the uploaded output files even more interesting.

My current workaround is to || true the test step so it always passes, but this is only good for debugging and should be removed later.

Is there any way to never skip the 2nd pipeline, but only running it after the 1st one finishes?

My current workaround is to || true the test step so it always passes, but this is only good for debugging and should be removed later.

Drone natively has syntax to execute pipeline steps and pipelines on failure.

Further reading on executing pipelines steps on failure:
https://docs.drone.io/pipeline/docker/syntax/conditions/#by-status

And executing pipelines on failure:
https://docs.drone.io/pipeline/docker/syntax/trigger/#by-status

This uploading step should be done using a docker container, so I created a second “normal” pipeline that depends_on the first exec pipeline.

If you ever expand Drone to more than a single machine, this will be problematic, because Drone makes no guarantee that two pipelines will execute on the same machine. For this reason, if it were me, I would create a small shell script that uploads artifacts and I would invoke that from a step in my exec pipeline, as opposed to using a separate Docker pipeline.

Good point regarding multiple nodes. Thanks for the “trigger by status” reference, I now got it working as intended by using depends_on + trigger for failed status, also had to add the triggers from the first pipeline again.

---
kind: pipeline
name: First
type: exec
# ...
trigger:
  ref:
    include:
      - refs/heads/master
      - refs/pull/**
      - refs/tags/**

---
kind: pipeline
name: Second
depends_on:
  - First
# ...
trigger:
  ref:
    include:
      - refs/heads/master
      - refs/pull/**
      - refs/tags/**
  status:
    - failure