File tree Expand file tree Collapse file tree 3 files changed +55
-69
lines changed Expand file tree Collapse file tree 3 files changed +55
-69
lines changed Original file line number Diff line number Diff line change 19
19
jobs :
20
20
check-for-moratorium :
21
21
if : fromJSON(inputs.isStableCandidate)
22
- uses : ./.github/workflows/ctc.yml
22
+ run : ./scripts/release/tps_lock_check cli ${{ github.sha }}
23
+ env :
24
+ TPS_API_TOKEN : ${{ secrets.TPS_API_TOKEN_PARAM }}
23
25
24
26
get-version-channel :
25
27
runs-on : ubuntu-latest
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -eu
3
+ set -o pipefail
4
+
5
+ if [ -z " $TPS_API_TOKEN " ]; then
6
+ echo " Requires environment variable: TPS_API_TOKEN" >&2
7
+ exit 1
8
+ fi
9
+
10
+ # Argument overrides the environment variable
11
+ component_slug=" ${1:- $COMPONENT_SLUG } "
12
+ if [ -z " $component_slug " ]; then
13
+ echo " Requires first argument: Heroku component slug" >&2
14
+ exit 1
15
+ fi
16
+
17
+ release_sha=" ${2:- $RELEASE_SHA } "
18
+ if [ -z " $release_sha " ]; then
19
+ echo " Requires second argument: SHA of the commit being released" >&2
20
+ exit 1
21
+ fi
22
+
23
+ response_status=0
24
+
25
+ tpsGetLock () {
26
+ response_status=" $( curl --w ' %{http_code}' \
27
+ -X PUT \
28
+ -H " Accept: application/json" \
29
+ -H " Content-Type: application/json" \
30
+ -H " Authorization: Token ${TPS_API_TOKEN} " \
31
+ -d " {\" lock\" : {\" sha\" : \" ${release_sha} \" , \" component_slug\" : \" ${component_slug} \" }}" \
32
+ https://tps.heroku.tools/api/ctc) "
33
+ }
34
+
35
+ echo " Requesting deployment lock from tps.heroku.tools…" >&2
36
+ retry_count=0
37
+ set +e
38
+ tpsGetLock
39
+ until [ " $response_status " == " 200" -a " $response_status " == " 201" ]
40
+ do
41
+ tpsGetLock
42
+ (( retry_count++ ))
43
+ if [ $retry_count -gt 40 ]
44
+ then
45
+ echo " ❌ Could not aquire deployment lock for \" $component_name \" after retrying for 10-minutes." >&2
46
+ exit 2
47
+ fi
48
+ echo " ⏳ Response status \" $response_status \" . Retry in 15-seconds…" >&2
49
+ sleep 15
50
+ done
51
+ set -e
52
+ echo " ✅ Lock acquired" >&2
You can’t perform that action at this time.
0 commit comments