Disable a Step ⚓
If you don’t want to remove the Step from your Workflow and you don’t want to duplicate the Workflow either (which is the preferred way if you want to experiment with new things; you can just create a “backup” clone of your original Workflow) then you can simply disable a Step by specifying
- script: run_if: false inputs: - content: |- #!/bin/bash echo "This will never run, because of run_if:false"
Run a Step only in CI environment, skip it for local builds ⚓
This is quite similar to how you completely disable a step,
but instead of specifying
run_if expression, you specify
.IsCI, which will only be true in CI mode.
This method can be useful to debug builds locally, where you don’t want to run
specific steps on your own Mac/PC. Lots of Steps have this
run_if flag set by default,
for example the
Git Clone step is configured with
run_if: .IsCI in the step’s
default configuration (
step.yml), because the most common use case when you
run a build locally is that you already have the code on your Mac/PC
and so you don’t want to do a
Git Clone. Of course you can change the
property of any step, so you can specify a
run_if: true for the
step if you want to run it locally too.
Run a Step only if the Build failed ⚓
To do this you have to switch to
(open the Workflow Editor on bitrise.io -> left side: click on
_to switch to the interactive
You have to add two properties to the Step you only want to run when the Build failed (at that point, when the Step would run):
is_always_run: true(this enables the Step to be considered to run even if a previous Step failed)
run_if: .IsBuildFailed(you can find more examples of the
run_iftemplate at: https://github.com/bitrise-io/bitrise/blob/master/_examples/experimentals/templates/bitrise.yml).
script step, which will only run if the Build failed:
- script: is_always_run: true run_if: .IsBuildFailed inputs: - content: |- #!/bin/bash echo "Build Failed!"
run_if to check a custom environment variable (you
can expose environment variables from your scripts too,
run_if will skip the step in every case when the value of
test value to test against.