CLI how to force run a utility workflow

I heavily use the bitrise CLI to test modifications to the build file. Sometimes, I just want to run a given utility workflow just for testing purpose and a more rapid loop than doing the full thing.

However, the CLI prevent to do that. Is there any arguments I can use to force execution of this flow?

If not, is this something that was rejected in the past? Would accept such feature request?

Regards,
Matt

1 Like

Hi @mvachon,

This is by design, we don’t plan to allow running utility workflows directly.

That said it’s quite easy to expose a utility workflow for run:

  1. Either remove the underscore from the beginning of the workflow id, to not to make it a utility workflow
  2. Or add an additional (non utility) workflow which just runs the utility workflow.

For this an example, using workflow chaining:

workflows:
  _my_utility_workflow:
    steps:
    - ...
    - ...

  run_utility_workflow:
    after_run:
    - _my_utility_workflow

run_utility_workflow doesn’t have any other property other then a single after_run which lists the utility workflow.
You don’t have to add any steps to that workflow, it’s perfectly fine to only declare after_run / before_run for a workflow and nothing else.

If you have any questions just let us know! :wink:

@viktorbenei For testing purpose, I currently do search/replace _publish_web and replace with publish_web and then run it.

With a such easy workaround, I really don’t see why the CLI could not have a --force flag that will enable to do it without having to tweak the bitrise.yml file.

I mean, if I explicit add the --force flag, I know what I’m doing. I understand utility workflows and I’m really not against keeping the default of not be able to run them by default.

But why should the CLI be so pedantic while I can simply edit the workflow?

I simple flag like this would be a simple improvement for “power” users. It should be more easy than doing a search/replace to test a utility workflow don’t you think :slight_smile:

1 Like

Ahh, you’re absolutely right. I think adding this functionality but protected by a flag makes sense, I’d support that! :wink:

If you have the time to implement this, please send a PR into https://github.com/bitrise-io/bitrise, otherwise just create a GitHub issue there.

If you need any help or info just let us know! :slight_smile: