-
Notifications
You must be signed in to change notification settings - Fork 49
147 lines (141 loc) · 4.76 KB
/
featurenet-create.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
147
---
name: FE - Create
on:
workflow_dispatch:
inputs:
featurenet-name:
description: 'Name of the featurenet'
type: string
required: true
ref:
description: "git ref: full commit hash, branch, tag - or 'mainnet' or 'testnet'"
type: string
required: true
expiration:
description: 'Time after which featurenet will be removed'
required: true
type: choice
options:
- 48h
- 24h
- 12h
- 3h
- 96h
- never
default: '48h'
validators:
description: 'Number of validators to start, from 0 to 50'
required: true
default: '5'
type: string
internal:
description: 'Internal network, accessible from VPN only'
required: true
type: boolean
default: false
short-session:
description: 'Use short session aleph-node binary'
required: true
type: boolean
sudo-account-id:
description: 'Sudo account ID'
type: string
required: false
default: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'
workflow_call:
inputs:
featurenet-name:
description: 'Name of the featurenet'
type: string
required: true
ref:
description: "git ref: full commit hash, branch, tag - or 'mainnet' or 'testnet'"
type: string
required: true
expiration:
description: 'Time after which featurenet will be removed'
required: true
type: string
default: '48h'
validators:
description: 'Number of validators to start, from 0 to 50'
required: true
default: '5'
type: string
internal:
description: 'Internal network, accessible from VPN only'
required: true
type: boolean
default: false
short-session:
description: 'Use short session aleph-node binary'
required: true
type: boolean
sudo-account-id:
description: 'Sudo account ID'
type: string
required: false
default: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'
jobs:
validate-inputs:
name: Validate inputs
runs-on: ubuntu-20.04
steps:
- name: Validate inputs
shell: bash
run: |
if [[ ! '${{ inputs.featurenet-name }}' =~ ^[a-z0-9][a-z0-9\-]{4,48}$ ]]; then
echo '!!! Invalid featurenet name'
exit 1
fi
if [[ ! '${{ inputs.ref }}' =~ ^[a-zA-Z0-9][a-zA-Z0-9\._\-]{1,48}$ ]]; then
echo "!!! Invalid ref"
exit 1
fi
check-vars-and-secrets:
name: Check vars and secrets
needs: [validate-inputs]
uses: ./.github/workflows/_check-vars-and-secrets.yml
secrets: inherit
get-full-docker-image-path:
name: Get full aleph-node full docker path path
needs: [check-vars-and-secrets]
runs-on: ubuntu-20.04
outputs:
fqdn-image: ${{ steps.get-aleph-node-fqdn-image.outputs.fqdn-image }}
ref: ${{ steps.get-aleph-node-fqdn-image.outputs.ref }}
image-exists: ${{ steps.get-aleph-node-fqdn-image.outputs.image-exists }}
steps:
- name: Get aleph-node fqdn path
id: get-aleph-node-fqdn-image
uses: Cardinal-Cryptography/github-actions/get-aleph-node-fqdn-image@v6
with:
ref: ${{ inputs.ref }}
test-binary: ${{ inputs.short-session == true && 'true' || 'false' }}
ecr-dev-node-repo: ${{ vars.ECR_DEV_ALEPH_NODE_REPO }}
ecr-prod-node-repo: ${{ vars.ECR_ALEPH_NODE_REPO }}
build-and-push-featurenet-node-image:
needs: [get-full-docker-image-path]
if: ${{ needs.get-full-docker-image-path.outputs.image-exists != 'true' }}
name: Build and push PR test docker image
uses: ./.github/workflows/_build-and-push-featurenet-node-image.yml
with:
ref: ${{ needs.get-full-docker-image-path.outputs.ref }}
fqdn-image: ${{ needs.get-full-docker-image-path.outputs.fqdn-image }}
short-session: ${{ inputs.short-session }}
secrets: inherit
create-featurenet:
needs: [get-full-docker-image-path, build-and-push-featurenet-node-image]
# to prevent this job to be skipped when on of the parent jobs is skipped
if: ${{ !cancelled() }}
name: Create featurenet
uses: Cardinal-Cryptography/github-actions/.github/workflows/_featurenet-create.yml@v6
secrets: inherit
with:
featurenet-name: ${{ inputs.featurenet-name }}
aleph-node-image: ${{ needs.get-full-docker-image-path.outputs.fqdn-image }}
validators: ${{ inputs.validators }}
expiration: ${{ inputs.expiration }}
internal: ${{ inputs.internal && true || false }}
delete-first: true
sudo-account-id: ${{ inputs.sudo-account-id }}