-
Notifications
You must be signed in to change notification settings - Fork 14
81 lines (75 loc) · 2.43 KB
/
Copy pathsnapshot-reset.yaml
File metadata and controls
81 lines (75 loc) · 2.43 KB
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
name: Internal Snapshot S3 Reset
on:
workflow_dispatch:
inputs:
chain:
required: true
description: 'chain'
default: 'odin-internal'
type: choice
options:
- internal-all
- odin-internal
- heimdall-internal
- thor-internal
concurrency:
group: release
jobs:
set-targets:
runs-on: ubuntu-latest
outputs:
snapshot_chains: ${{ steps.set-matrix.outputs.snapshot_chains }}
bridge_chains: ${{ steps.set-matrix.outputs.bridge_chains }}
steps:
- id: set-matrix
run: |
INTERNAL_ALL='[ "odin", "heimdall", "thor" ]'
INPUT="${{ github.event.inputs.chain }}"
if [[ $INPUT == "internal-all" ]]; then
SNAPSHOT_CHAINS=$INTERNAL_ALL
BRIDGE_CHAINS=$INTERNAL_ALL
elif [[ $INPUT == "preview-all" ]]; then
SNAPSHOT_CHAINS=$PREVIEW_ALL
BRIDGE_CHAINS=$PREVIEW_ALL
else
CHAIN=${INPUT%"-internal"}
SNAPSHOT_CHAINS="[ \"$CHAIN\" ]"
if [[ $CHAIN == odin* ]]; then
ALL=$([[ $CHAIN != *-preview ]] && echo $INTERNAL_ALL || echo $PREVIEW_ALL)
BRIDGE_CHAINS=$(echo $ALL | sed -r 's/\"odin(-preview)?\", //')
else
BRIDGE_CHAINS=$SNAPSHOT_CHAINS
fi
fi
echo "snapshot_chains=$(echo $SNAPSHOT_CHAINS)" >> $GITHUB_OUTPUT
echo "bridge_chains=$(echo $BRIDGE_CHAINS)" >> $GITHUB_OUTPUT
reset-snapshot:
needs: [set-targets]
strategy:
matrix:
snapshot_chains: ${{ fromJson(needs.set-targets.outputs.snapshot_chains) }}
runs-on: ubuntu-latest
environment:
name: internal
steps:
- uses: actions/checkout@v3
- name: reset internal snapshot
run: |
echo "y" | bash .github/scripts/reset-snapshot.sh ${{ matrix.snapshot_chains }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
reset-bridge-service:
needs: [reset-snapshot, set-targets]
strategy:
fail-fast: false
matrix:
bridge_chain: ${{ fromJson(needs.set-targets.outputs.bridge_chains) }}
exclude:
- bridge_chain: odin
uses: ./.github/workflows/reset-bridge-service.yaml
secrets: inherit
with:
network: ${{ matrix.bridge_chain }}