-
Notifications
You must be signed in to change notification settings - Fork 434
180 lines (166 loc) · 6.69 KB
/
run-a-single-node-from-branch.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: 'Run a node with selected configuration'
on:
workflow_dispatch:
inputs:
network:
description: "Select a network on which You want to run a node"
default: "mainnet"
required: true
type: choice
options:
- mainnet
- gnosis
- sepolia
- goerli
- chiado
cl_client:
description: "Select Consensus Layer Client to run node against"
default: ""
required: true
type: choice
options:
- lighthouse
- lodestar
#- nimbus
- prysm
- teku
cl_custom_image:
description: "In case of need to run non-default cl image (different than actually supported by Sedge) put it in there"
default: ""
required: false
config:
description: "Select a config file which will be selected for tests."
default: "default.json"
required: true
type: choice
options:
- default.json
- archiveSync.json
- fastSync.json
- fullSync.json
- fuzzer.json
non_validator_mode:
description: "If checked, node will be started in NonValidator mode (OldBodies and oldReceipts will not be synced)"
default: true
type: boolean
timeout:
description: "Timeout in hours before triggering the deletion of smoke test instances. Maximum time of node lifetime can be 72 hours."
default: "24"
required: true
volume:
description: "In case custom volume size needs to be applied, put value in GB here)"
required: false
default: ""
additional_nethermind_flags:
description: "Provide any additional flags to the Nethermind in space-separated format. Example: \"JsonRpc.Enabled=false Sync.SnapSync=false\"."
default: ""
required: false
additional_cl_flags:
description: "Provide any additional flags to the CL client in space-separated format. Example: \"clflag1=1 clflag2=2\"."
default: ""
required: false
ssh_keys:
description: "SSH Keys to be installed in the smoke test nodes (separated by commas without space in-between commas) for example: key1,key2,key3"
default: ""
required: false
jobs:
create_docker_image:
runs-on: ubuntu-latest
outputs:
base_tag: ${{ steps.set-base-tag.outputs.base_tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Prepare docker tag
id: prepare_ref
run: |
REF_NAME=${{ github.ref }}
CLEAN_REF=$(echo "${REF_NAME/refs\/heads\//}" | sed 's/[^a-zA-Z0-9._-]/-/g')
echo "CLEAN_REF=$CLEAN_REF" >> $GITHUB_ENV
- name: Set BASE_TAG
id: set-base-tag
env:
GITHUB_USERNAME: ${{ github.actor }}
run: |
BASE_TAG="${GITHUB_USERNAME:0:1}$(shuf -i 1000-9999 -n 1)"
echo "BASE_TAG=$BASE_TAG" >> $GITHUB_ENV
echo "::set-output name=base_tag::$BASE_TAG"
- name: Creating a node with NodeName="DevNode-${{ github.actor }}-${{ env.BASE_TAG }}-${{ env.CLEAN_REF }}-${{ inputs.network }}-${{ inputs.cl_client }}"
run: echo "NodeName='DevNode-${{ github.actor }}-${{ env.BASE_TAG }}-${{ env.CLEAN_REF }}-${{ inputs.network }}-${{ inputs.cl_client }}'"
- name: Set Repo Variable
run: |
echo "REPO=$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Trigger Docker Build Action with Cleaned Ref
uses: benc-uk/workflow-dispatch@v1
with:
workflow: build-nethermind-docker-images.yml
ref: "${{ github.ref }}"
token: "${{ secrets.REPOSITORY_DISPATCH_TOKEN }}"
inputs: '{
"repo": "${{ env.REPO }}",
"tag": "${{ env.CLEAN_REF }}",
"dockerfile": "Dockerfile"
}'
- name: Set Repo and Org Variables
run: |
echo "ORG_NAME=$(echo $GITHUB_REPOSITORY | cut -d / -f 1)" >> $GITHUB_ENV
echo "REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d / -f 2)" >> $GITHUB_ENV
- name: Wait for Docker Build Action to complete
env:
GITHUB_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_TOKEN }}
WORKFLOW_ID: 'build-nethermind-docker-images.yml'
MAX_WAIT_MINUTES: '5'
INTERVAL: '5'
TIMEOUT: '10'
ORG_NAME: ${{ env.ORG_NAME }}
REPO_NAME: ${{ env.REPO_NAME }}
REF: ${{ github.ref }}
run: |
chmod +x scripts/wait-for-workflow-completed.sh
./scripts/wait-for-workflow-completed.sh
working-directory: ${{ github.workspace }}
trigger_node_and_vm_creation:
needs: create_docker_image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Prepare docker tag
id: prepare_ref
run: |
REF_NAME=${{ github.ref }}
CLEAN_REF=$(echo "${REF_NAME/refs\/heads\//}" | sed 's/[^a-zA-Z0-9._-]/-/g')
echo "CLEAN_REF=$CLEAN_REF" >> $GITHUB_ENV
- name: Use BASE_TAG
run: |
echo "BASE_TAG=${{ needs.create_docker_image.outputs.base_tag }}" >> $GITHUB_ENV
- name: Trigger Node creation Repo Action
uses: benc-uk/workflow-dispatch@v1
with:
workflow: run-single-node.yml
repo: NethermindEth/post-merge-smoke-tests
ref: "main"
token: "${{ secrets.REPOSITORY_DISPATCH_TOKEN }}"
inputs: '{
"github_username": "${{ github.actor }}",
"base_tag": "${{ env.BASE_TAG }}",
"config_file": "${{ inputs.config }}",
"nethermind_branch": "${{ env.CLEAN_REF }}",
"network": "${{ inputs.network }}",
"cl_client": "${{ inputs.cl_client }}",
"additional_options": "{\"cl_custom_image\":\"${{ inputs.cl_custom_image }}\", \"timeout\":\"${{ inputs.timeout }}\", \"non_validator_mode\":${{ inputs.non_validator_mode }}, \"volume_size\":\"${{ inputs.volume }}\", \"additional_nethermind_flags\":\"${{ inputs.additional_nethermind_flags }}\", \"additional_cl_flags\":\"${{ inputs.additional_cl_flags }}\", \"ssh_keys\":\"${{ inputs.ssh_keys }}\"}"
}'
- name: Wait for creation of node
env:
GITHUB_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_TOKEN }}
WORKFLOW_ID: 'run-single-node.yml'
MAX_WAIT_MINUTES: '5'
INTERVAL: '5'
TIMEOUT: '20'
ORG_NAME: 'NethermindEth'
REPO_NAME: 'post-merge-smoke-tests'
REF: 'main'
run: |
chmod +x scripts/wait-for-workflow-completed.sh
./scripts/wait-for-workflow-completed.sh
working-directory: ${{ github.workspace }}