-
Notifications
You must be signed in to change notification settings - Fork 22
/
step.yml
146 lines (122 loc) · 7.75 KB
/
step.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
title: Bitrise Start Build
summary: Starts a new build with the specified Workflow(s).
description: |-
The Step starts a new build of the same app with specified Workflow(s). On its own, the Step can be used to start multiple builds that run in parallel. In combination with the **Bitrise Wait for Build** Step, you can also add additional Steps to run in parallel while the triggered builds are running. For an example, check out our [Start builds from a parent Workflow](https://devcenter.bitrise.io/en/steps-and-workflows/generic-workflow-recipes/start--parallel--builds-from-the-workflow.html##) Workflow Recipe.
You can put this Step in a Workflow that is triggered by a code push or pull request and use this Step to trigger multiple other builds at the same time.
To do that, you need multiple concurrencies - at least two! You also need a Personal Access Token to use the Step: [check out our guide](https://devcenter.bitrise.io/getting-started/account-security/#generating-personal-access-tokens-manually) on how to generate the token.
If manual build approval is enabled for the project, this step won't be able to start new builds automatically.
### Configuring the Step
Before you run a build with this Step, make sure you have your Personal Access Token stored in a [Secret Environment Variable](https://devcenter.bitrise.io/builds/env-vars-secret-env-vars/#adding-a-secret-env-var).
Note that all builds you trigger using this Step will have the same build number!
1. Set up at least two Workflows in the Workflow Editor: one will contain the Step, the other will be triggered by the Step.
You can set up as many Workflows as you wish: your number of concurrencies limit the number of Workflows you can run simultaneously.
2. Add the **Bitrise Start Build** Step to the part of the Workflow where you want to trigger another build.
3. Add the Secret Env Var storing your Personal Access Token to the **Bitrise Access Token** input of the **Bitrise Start Build** Step: click the **Select secret variable** button, and choose the key you created.
4. Find the **Workflows** input of the **Bitrise Start Build** Step, and add the Workflow(s) you want to run.
5. In the **Environments to share** input, add Environment Variables (Env Vars) that you want to share between the builds triggered by the Step.
6. (Optional) You can set the **Wait for builds** input to `true` if you would like to pause the current build until the triggered build(s) are finished.
7. (Optional) You can add any Step you would like to run in parallel while the triggered Workflow(s) are running in the parent Workflow.
Make sure to add the **Bitrise Wait for Build** Step to the end of Workflow.
8. Add the Secret Env Var storing your Personal Access Token to the **Bitrise Access Token** input of the **Bitrise Wait for Build** Step: click the **Select secret variable** button, and choose the key you created.
9. In the **Build slugs** input, define the builds for the Step.
The build slugs you need are stored by the **Bitrise Start Build** Step in the `$ROUTER_STARTED_BUILD_SLUGS` Env Var. As long as the builds defined by the slugs are running, the Step will hold the build it is running in. The build will fail if any of the builds included in the Step fail.
10. Optionally, you can save the build artifacts from the builds and configure the Step to abort all builds if any of the builds fail:
- In **The path of the build artifacts** input, set where you'd like to save the artifacts.
The value of the input must be an actual, existing path, ending with `/`.
- Set the **Abort all builds if one fails** input to either `yes` or `no`.
Please note that the build artifacts of child Workflows - Workflows triggered by this Step - will be only available if the child Workflow contains a **Deploy to Bitrise.io** Step.
### Troubleshooting
- Make sure you have both the **Bitrise Start Build** and the **Bitrise Wait for Build** Steps in the right place in your initial Workflow.
- Always check all your builds: if your concurrencies are taken up by other builds, this Step cannot start new ones.
- Your Personal Access Token can expire! Make sure it's still valid - without it, you can't start new builds with this Step.
### Useful links
- [Starting parallel builds with a single Workflow](https://devcenter.bitrise.io/builds/triggering-builds/trigger-multiple-workflows/)
- [Start builds from a parent Workflow](https://devcenter.bitrise.io/en/steps-and-workflows/generic-workflow-recipes/start--parallel--builds-from-the-workflow.html##)
### Related Steps
- [Bitrise Wait for Build](https://www.bitrise.io/integrations/steps/build-router-wait)
- [Bitrise Run](https://www.bitrise.io/integrations/steps/bitrise-run)
- [Build Status Change](https://www.bitrise.io/integrations/steps/build-status-change)
website: https://github.com/bitrise-steplib/bitrise-step-build-router-start
source_code_url: https://github.com/bitrise-steplib/bitrise-step-build-router-start
support_url: https://github.com/bitrise-steplib/bitrise-step-build-router-start/issues
type_tags:
- utility
is_always_run: false
is_skippable: false
toolkit:
go:
package_name: github.com/bitrise-steplib/bitrise-step-build-router-start
inputs:
- access_token:
opts:
title: Bitrise Access Token
summary: Your access token
description: |
Your access token
To acquire a `Personal Access Token` for your user, sign in with that user on [bitrise.io](https://bitrise.io),
go to your `Account Settings` page, and select the [Security tab](https://www.bitrise.io/me/profile#/security) on the left side.
is_required: true
is_expand: true
is_sensitive: true
- workflows:
opts:
title: Workflows
summary: The Workflow(s) to start. One Workflow per line.
description: The Workflow(s) to start. One Workflow per line.
is_required: true
- environment_key_list:
opts:
title: Environments to share
summary: The keys of the envs which will be shared with the triggered Workflows.
description: |-
The keys of the envs which will be shared with the triggered Workflows.
**FORMAT** Seperate the keys with new line. E.g:
`ENV_1`
`ENV_2`
`ENV_3`
is_expand: false
is_required: false
- wait_for_builds: "false"
opts:
title: Wait for builds
summary: Should the Step wait for the builds to be finished?
description: Should the Step wait for the builds to be finished?
is_required: false
value_options:
- "false"
- "true"
- build_artifacts_save_path:
opts:
title: The path of the build artifacts
summary: The path that the build artifacts will be saved to if the **Wait for builds** input is set to `true`.
description: |
The path where build artifacts will be saved to if the **Wait for builds** input is set to `true`.
Note that when this Step triggers a Workflow, the artifacts of the triggered Workflow are only available to the Workflow that contains this Step, and not other Workflows.
The triggered Workflow MUST have a **Deploy to Bitrise.io** Step to deploy build artifacts!
is_required: false
is_sensitive: false
- abort_on_fail: "no"
opts:
title: Abort all builds if any of them
description: |-
Abort all started builds if any build fails
is_required: true
is_sensitive: false
value_options:
- "yes"
- "no"
- verbose: "no"
opts:
title: Enable verbose log?
description: |-
You can enable the verbose log for easier debugging.
is_required: true
value_options:
- "yes"
- "no"
outputs:
- ROUTER_STARTED_BUILD_SLUGS:
opts:
title: Started Build Slugs
summary: Newline separated list of started build slugs.
description: Newline separated list of started build slugs.