“I want to re-run a step without re-running the entire pipeline”
Drone is designed so that pipeline steps are run inside ephemeral containers that are destroyed when the pipeline completes. This means files that are cloned, downloaded, compiled, generated, etc are destroyed as well. Each step usually relies on the previous steps and their outputs.
Drone is designed this way to improve the security of builds (less chance of a secret remaining in the environment for a later pipeline to access), and to prevent “contamination” of later pipelines run on the host. This approach ensures that every build is made in a clean environment.
This is why you cannot resume a completed build at a particular step.
If you still want to re-run certain steps. There are some ways in which you can do this:
-
You are using commands in the step
If you are running commands in a step, you can use bash to implement retries eg repeat commands until success -
Testing
Generally the test framework itself has features to help mitigate flakiness, eg in Ruby rspec-retry allows you to setup custom logic around problematic tests. -
Separate your build into different pipelines:
If your deployment is failing because of a unit test, to increase readability and separate concerns. we recommend breaking out separate pipelines for unit tests / CI. Then have your deployment as a separate pipeline that depends on the artefacts from your CI. Graph execution -
drone-cli
Drone-cli provides the ability to run docker builds and start a build from a particular point. This is particularly useful for debugging pipelines. drone-cli