When 1 fails, the workflow should stop. As long as 1 passes, even if 2 fails, workflow should continue to 3 and 4. How should I configure this?
In such a workflow, the “Run if previous Step failed” switch only works on 2 (for which I should uncheck), but not on 3 or 4. If I check “Run if previous Step failed” for 3 or 4, then when 1 fails, they will still run, which is pointless.
If you’d need the build to fail but want to run specific steps even if a previous step fails, then you can mark those steps to “always run” (Run if previous Step failed) on the web UI, just enable this option/toggle:
If I understood correctly @sah doesn’t want to run steps 2-4 if 1. fails. So is_always_run for steps 2-4 is not a solution. On the other hand, if 1. fails next ones will fail immediately so effectively there is a little difference between this and not running steps 2-4.
It seems that such effect is not directly achievable with single switches, but here are some examples:
Yes, you are right. The workflow should logically be something like this:
[BUILD] => [TEST] => [COVERAGE]
2. Unit test
/ \
1. Package 4. Jacoco report
\ /
3. Instrumental test
, where 2 and 3 could actually run in parallel, as long as 1 passes. And as long as either (2 or 3) is run, pass or fail, 4 should run. It’s similar to the stage concept in gitlab-ci.
Does this look like something that should be supported by bitrise? Your suggestion looks a bit hacky, and honestly I haven’t figured out how to use is_always_run and run_if to achieve this.
OK now I understand your solution. But still, it feels a bit hacky. I think Bitrise should provide something similar to the stage concept. Do you think?
In the meantime, in this specific case I’d suggest you to simply check the report before uploading it, whether it exists at the path. Mark the “Jacoco report upload” step with is_always_run: true and simply check whether the report is available at the path. If no other step is marked with is_always_run then if Package would fail the report will not be generated, and so the report uploader step will simply terminate due to the lack of report file to upload. If “Package” step succeeds then the process will continue with the unit test step. If that fails indeed this will skip the VDT step but the report will still be uploaded by the uploader step.
Depends on the details of course, whether you actually need to run the VDT step if the Unit Test step fails, otherwise this should provide the functionality you described.