Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 647f9ab

Browse files
Updated README, action name, add branding
1 parent 606ded2 commit 647f9ab

File tree

2 files changed

+55
-13
lines changed

2 files changed

+55
-13
lines changed

README.md

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
_Assumption_ : You are managing cloud infrastructure with terraform remote state in "github actions"
44

5+
Wait-For-Other-Pipelines is a GitHub Action to enable parallel runs to wait on a step so they will
6+
not fail to acquire remote state lock.
7+
8+
This action is tested to run on ubuntu.
9+
10+
```
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
```
17+
518
If the same workflow is used by multiple branches or there are multiple commits in the same branch chances are that
619
the workflow runs after 1st run might get failed due to not being able to acquire lock on terraform remote state as
720
1st run is already having the lock in place.
@@ -13,13 +26,48 @@ By doing so the consequent runs will wait till the previous runs are complete.
1326
But when a previous completed run is rerun while there are newer runs in the queue, the newer runs will wait till the rerun is complete.
1427
The rerun will also wait for any run which has already crossed the wait step.
1528

29+
## Action Inputs
30+
31+
<table>
32+
<thead>
33+
<tr>
34+
<th>Input</th>
35+
<th>Required</th>
36+
<th>Description</th>
37+
</tr>
38+
</thead>
39+
40+
<tr>
41+
<td>step-name</td>
42+
<td>Yes</td>
43+
<td>
44+
Name of the step where the action is used.
45+
</td>
46+
</tr>
47+
48+
</table>
49+
50+
## Examples
51+
52+
The example below shows how the `Wait-For-Other-Pipelines` action can be used
53+
to wait for other pipeline runs.
54+
55+
```
56+
- name: Wait For Other Pipelines
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
uses: otto-de/[email protected]
60+
with:
61+
step-name: "Wait For Other Pipelines"
62+
```
63+
1664
# Below are the steps to achieve parallel jobs running in github workflow to wait on a particular step
1765

1866
1. Name the step as needed. For example: "Wait for other pipelines"
19-
2. Use the action "otto-de/github-actions-wait@v1" with the step name as input as shown below.
67+
2. Use the action "otto-de/github-actions-wait@v1.0" with the step name as input as shown below.
2068
The argument to the script should be the same as step name.
2169
Accept the env defined in the sample shown below as it is, since the env set is used to make API calls to github
22-
3. Place the wait step/s in the workflow in such places so that the following steps should not run in parallel by other jobs.
70+
3. Place the wait step/s in the workflow in such a place so that the following steps should not run in parallel by other jobs.
2371
An example of this wait step could be the terraform apply steps which use remote state lock feature. If 2 jobs try to use same remote state the 2nd job will fail.
2472
4. How the script works is as below:
2573
1. If the number of running jobs is 1, then there is no other job running, there will not be any waiting
@@ -30,15 +78,6 @@ Accept the env defined in the sample shown below as it is, since the env set is
3078
1. If wait step is crossed for any of the newer jobs, then wait the current rerun job till the already running newer job to finish
3179
2. If no wait step is crossed for any of the newer jobs, rerun will continue execution without waiting
3280

33-
```
34-
- name: Wait
35-
env:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
uses: otto-de/github-actions-wait@v1
38-
with:
39-
step-name: "Wait"
40-
```
41-
4281
# Future work
4382

4483
1. Multiple wait steps

action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
name: 'Wait'
2-
description: 'Wait'
1+
name: 'Wait-For-Other-Pipelines'
2+
description: 'Wait for other pipelines'
3+
branding:
4+
icon: pause
5+
color: purple
36
inputs:
47
step-name: # id of input
58
description: 'Step Name'

0 commit comments

Comments
 (0)