-
Notifications
You must be signed in to change notification settings - Fork 2
162 lines (154 loc) · 5.91 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
---
name: FE - Create
on:
workflow_call:
inputs:
featurenet-name:
description: 'Name of the featurenet'
required: true
type: string
aleph-node-image:
description: "FQDN of aleph-node image"
required: true
type: string
chain-bootstrapper-image:
description: "FQDN of chain-bootstrapper image"
required: true
type: string
expiration:
description: 'Time after which featurenet will be removed: "Xh" or "never"'
required: false
type: string
default: 48h
validators:
description: 'Number of validators to start, from 0 to 50'
required: false
default: '5'
type: string
internal:
description: 'Internal network, accessible from VPN only'
required: false
type: boolean
default: false
rolling-update-partition:
description: |
Number from 0 to N-1, where N is size of am existing featurenet.
All aleph-node-validator-N with an ordinal N that is great than or equal to the partition
will be updated. If not specified, all nodes will be updated.
required: false
default: '0'
type: string
delete-first:
description: 'Delete featurenet before upserting'
required: false
type: boolean
default: false
sudo-account-id:
description: 'Sudo account ID'
type: string
required: false
default: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'
finality-version:
description: 'Finality version to start FE with. Must be a cardinal number'
type: string
required: false
outputs:
ws-hostname:
description: Hostname of the WS endpoint
value: ${{ jobs.create-featurenet.outputs.ws-hostname }}
jobs:
validate-inputs:
name: Validate inputs
runs-on: ubuntu-20.04
steps:
- name: Validate inputs
shell: bash
# yamllint disable rule:line-length
run: |
if [[ ! '${{ inputs.featurenet-name }}' =~ ^[a-z0-9][a-z0-9\-]{4,48}$ ]]
then
echo '!!! Invalid featurenet name'
exit 1
fi
if [[ ! '${{ inputs.aleph-node-image }}' =~ ^[a-z0-9][a-z0-9\._:/\-]{1,52}$ ]]; then
echo "!!! Invalid aleph-node image"
exit 1
fi
if [[ ! '${{ inputs.chain-bootstrapper-image }}' =~ ^[a-z0-9][a-z0-9\._:/\-]{1,56}$ ]]; then
echo "!!! Invalid chain-bootstrapper image"
exit 1
fi
if [[ ! '${{ inputs.sudo-account-id }}' =~ ^[a-zA-Z0-9]{48}$ ]]; then
echo "!!! Invalid sudo-account-id"
exit 1
fi
# yamllint enable rule:line-length
check-vars-and-secrets:
needs: [validate-inputs]
name: Check vars and secrets
uses: ./.github/workflows/_check-vars-and-secrets.yml
secrets: inherit
create-featurenet:
needs: [check-vars-and-secrets]
name: Create featurenet
runs-on: [self-hosted, Linux, X64, small]
outputs:
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
ws-hostname: ${{ steps.create-featurenet.outputs.ws-hostname }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Delete old featurenet app and data
if: ${{ inputs.delete-first == true }}
uses: Cardinal-Cryptography/github-actions/delete-featurenet@v7
with:
gh-ci-user: ${{ secrets.CI_GH_USER }}
gh-ci-token: ${{ secrets.CI_GH_TOKEN }}
aws-access-key-id: ${{ secrets.AWS_DEVNET_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEVNET_SECRET_ACCESS_KEY }}
argo-sync-user-token: ${{ secrets.ARGO_SYNC_USER_TOKEN }}
repo-featurenet-template-name: ${{ secrets.REPO_FEATURENET_TEMPLATE_NAME }}
featurenet-name: ${{ inputs.featurenet-name }}
git-commit-author: ${{ secrets.AUTOCOMMIT_AUTHOR }}
git-commit-email: ${{ secrets.AUTOCOMMIT_EMAIL }}
- name: Start featurenet Deployment
uses: bobheadxi/deployments@v1
id: deployment
with:
step: start
token: ${{ secrets.CI_GH_TOKEN }}
env: ${{ inputs.featurenet-name }}
override: true
debug: true
- name: Create featurenet with image tag
uses: Cardinal-Cryptography/github-actions/create-featurenet@v7
id: create-featurenet
with:
gh-ci-user: ${{ secrets.CI_GH_USER }}
gh-ci-token: ${{ secrets.CI_GH_TOKEN }}
argo-sync-user-token: ${{ secrets.ARGO_SYNC_USER_TOKEN }}
repo-featurenet-template-name: ${{ secrets.REPO_FEATURENET_TEMPLATE_NAME }}
featurenet-name: ${{ inputs.featurenet-name }}
featurenet-aleph-node-image: ${{ inputs.aleph-node-image }}
featurenet-chain-bootstrapper-image: ${{ inputs.chain-bootstrapper-image }}
expiration: ${{ inputs.expiration }}
validators: ${{ inputs.validators }}
internal: ${{ inputs.internal && 'true' || 'false' }}
rolling-update-partition: ${{ inputs.rolling-update-partition }}
git-commit-author: ${{ secrets.AUTOCOMMIT_AUTHOR }}
git-commit-email: ${{ secrets.AUTOCOMMIT_EMAIL }}
wait-for-finalized-heads: "true"
sudo-account-id: ${{ inputs.sudo-account-id }}
finality-version: ${{ inputs.finality-version }}
- name: Finish featurenet Deployment
uses: bobheadxi/deployments@v1
if: always()
with:
step: finish
token: ${{ secrets.CI_GH_TOKEN }}
status: ${{ job.status }}
env: ${{ inputs.featurenet-name }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
# yamllint disable-line rule:line-length
env_url: https://dev.azero.dev/?rpc=wss%3A%2F%2F${{ steps.create-featurenet.outputs.ws-hostname }}#/explorer
debug: true