Default to first workflow when starting a build

Starting a build from the web should work correctly. Instead, errors are generated by default because there’s no default workflow. If you look at the user experience on other build providers, there’s a start build button. When that button is pressed, a build is started. I’d like the same experience on Bitrise. The easy fix would be defaulting to the first available workflow.

The workflow is selected by the parameters you specify and the Trigger Map you configured for the project. The default configs (if you register a new app) include all the patterns to have a “default” workflow (called “primary”), but you can of course change your trigger maps / patterns so that you won’t have a default workflow (which you most likely did).

That said, “first available workflow” is a bit too broad; workflows are not stored in a given order, those are a “hash” in the YML.

I definitely agree that this should be handled better, just need a bit more info how this should be handled / improved :wink:

You can also select which workflow you want to use for the build in the Start a Build popup, right above the Start Build button

Maybe add a “Make this workflow the default” option in this dialog so I don’t have to select the same one over and over again?

I think this is missing the use case. At other build providers, the only parameter is the branch name. That means pressing “Start a build” is sufficient information to start a build. If there is only one workflow, then selecting that by default instead of erroring seems to make more sense?

Some of my apps don’t have a Trigger Map because they are only used manually. I don’t want the build to be triggered otherwise. I don’t think the Trigger Map supports a manual only trigger? If the YAML defined a branch to workflow mapping for the Start Build button then that’d be helpful.

Just disable or delete the webhook on GitHub/your git hosting service if you don’t want to auto trigger builds at all, then you can have any kind of trigger map :wink:

That’s exactly what the trigger map does :slight_smile:

Makes sense, seems reasonable, although single workflow configs are rather the exception not the norm.

P.S.: if you do this manual trigger frequently it might worth to do it with a saved curl command - switch to Advanced mode in the start/schedule a build popup, and save the curl command (from the bottom of the popup) into a file and trigger with that file.

trigger_map:
- push_branch: "*"
  workflow: primary
- pull_request_target_branch: "*"
  pull_request_source_branch: "*"
  workflow: primary
- tag: "*"
  workflow: primary

I don’t see any way to map only the “start a build”? The workflow should never be triggered by push/pull/tag.

The problem is I do need to auto trigger builds, just not for all workflows. This use case isn’t handled well.

Ahh, ok, I misunderstood you; I thought you don’t want to auto trigger any builds for that app.

We’ll discuss this and try to find a good solution, thanks for the #feature-request @bootstraponline!
In the meantime please select the Workflow at the bottom of the popup, to explicitly select a workflow for the build.

1 Like

I’m running into this again. When there is no trigger map (manual only build), the primary workflow is not recognized as the default option. It’d be nice to have this work by default instead of always requiring the user to manually select a workflow. Or maybe it could be like branch name, where the UI remembers the last selected workflow when there is no trigger map.

I agree using the trigger map makes sense, however the use case where that doesn’t exist is not ideal.

1 Like

^ this is what I want (default workflow, used when there’s no trigger map).

1 Like