-
Notifications
You must be signed in to change notification settings - Fork 54
202 lines (177 loc) · 7.01 KB
/
Copy pathflow-migration-test.yaml
File metadata and controls
202 lines (177 loc) · 7.01 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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##
name: "Test Migration Process"
on:
workflow_dispatch:
inputs:
from-solo-version:
description: 'Solo version to use before migration'
required: false
type: string
to-consensus-node-version:
description: 'Consensus node release tag to use after migration'
required: false
type: string
workflow_call:
inputs:
from-solo-version:
required: false
type: string
to-consensus-node-version:
required: false
type: string
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
defaults:
run:
shell: bash
permissions:
contents: read
actions: read
env:
STEP_TIMEOUT_MINUTES: '5'
KIND_DOCKER_REGISTRY_MIRRORS: ${{ vars.KIND_DOCKER_REGISTRY_MIRRORS }}
jobs:
test-migration-process:
name: Migrate Solo from Prior to Current Version
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
timeout-minutes: 60
runs-on: hiero-solo-linux-large
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
timeout-minutes: ${{ fromJSON(env.STEP_TIMEOUT_MINUTES) }}
with:
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
timeout-minutes: ${{ fromJSON(env.STEP_TIMEOUT_MINUTES) }}
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
timeout-minutes: ${{ fromJSON(env.STEP_TIMEOUT_MINUTES) }}
with:
node-version: 22
cache: npm
- name: Setup Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
timeout-minutes: ${{ fromJSON(env.STEP_TIMEOUT_MINUTES) }}
with:
version: "v3.12.3" # helm version
- name: Setup Kind
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
timeout-minutes: ${{ fromJSON(env.STEP_TIMEOUT_MINUTES) }}
with:
install_only: true
node_image: kindest/node:v1.31.4@sha256:2cb39f7295fe7eafee0842b1052a599a4fb0f8bcf3f83d96c7f4864c357c6c30
version: v0.26.0
kubectl_version: v1.31.4
verbosity: 3
wait: 120s
- name: Install Kubectl
uses: step-security/setup-kubectl@b256bc71248a59f1e3a278fc75a65646d6a8a1c4 # pinned to v5.1.0
timeout-minutes: ${{ fromJSON(env.STEP_TIMEOUT_MINUTES) }}
with:
version: 'v1.27.3'
id: install
- name: Resolve Input Versions
id: get-version
uses: step-security/retry@38808b4332b98bb36ca031abff0c100231608288 # v4.0.0
with:
max_attempts: 3
timeout_minutes: 5
command: |
source .github/workflows/script/helper.sh
FROM_INPUT="${{ inputs.from-solo-version }}"
TO_CN_INPUT="${{ inputs.to-consensus-node-version }}"
if [[ -z "${FROM_INPUT}" ]]; then
FROM_INPUT=$(curl -s https://registry.npmjs.org/@hashgraph/solo/latest | jq -r '.version')
fi
if [[ -z "${TO_CN_INPUT}" ]]; then
TO_CN_INPUT=$(extract_version TEST_UPGRADE_TO_VERSION version-test.ts)
fi
if [[ -z "${TO_CN_INPUT}" ]]; then
echo "Failed to resolve to-consensus-node-version input or TEST_UPGRADE_TO_VERSION from version-test.ts"
exit 1
fi
echo "From Solo Version: ${FROM_INPUT}"
echo "To Consensus Node Version: ${TO_CN_INPUT}"
echo "from_solo_version=${FROM_INPUT}" >> $GITHUB_OUTPUT
echo "to_consensus_node_version=${TO_CN_INPUT}" >> $GITHUB_OUTPUT
- name: Launch Network with Prior Release ${{ steps.get-version.outputs.from_solo_version }}
timeout-minutes: 60
run: |
export PATH=~/.solo/bin:${PATH}
echo "Configure APT to use main Ubuntu archive (disable mirror rotation)..."
sudo sed -i 's|http://[a-z.]*.ubuntu.com|http://archive.ubuntu.com|g' /etc/apt/sources.list
echo "Install yq..."
YQ_VERSION="v4.44.1"
YQ_BINARY="yq_linux_amd64"
wget -q "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}" -O /tmp/yq
sudo chmod +x /tmp/yq
sudo mv /tmp/yq /usr/local/bin/yq
yq --version
npm install
task build:compile
# Run the script in the background and trap SIGTERM/SIGINT so that a workflow
# cancellation (e.g. triggered by a new commit on this PR) terminates the
# launch immediately rather than waiting up to 60 minutes for it to finish
# on its own.
SCRIPT_PID=""
RC=0
cleanup() {
if [[ -n "${SCRIPT_PID}" ]]; then
echo "Received cancellation signal, stopping launch_network.sh (PID ${SCRIPT_PID})..."
kill "${SCRIPT_PID}" 2>/dev/null || true
wait "${SCRIPT_PID}" 2>/dev/null || true
fi
exit 1
}
trap cleanup SIGTERM SIGINT
.github/workflows/script/launch_network.sh \
"${{ steps.get-version.outputs.from_solo_version }}" \
"${{ steps.get-version.outputs.to_consensus_node_version }}" &
SCRIPT_PID=$!
wait "${SCRIPT_PID}" || RC=$?
SCRIPT_PID=""
trap - SIGTERM SIGINT
if [[ "$RC" != "0" ]]; then
echo "Failed to launch network with release version ${{ steps.get-version.outputs.from_solo_version }}"
exit $RC
fi
- name: Collect Deployment Diagnostics Logs
if: ${{ !cancelled() && always() }}
timeout-minutes: ${{ fromJSON(env.STEP_TIMEOUT_MINUTES) }}
run: |
export PATH=~/.solo/bin:${PATH}
npm run solo-test -- deployment diagnostics logs -q --dev || true
- name: Upload Logs to GitHub
if: ${{ !cancelled() && always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
timeout-minutes: ${{ fromJSON(env.STEP_TIMEOUT_MINUTES) }}
with:
name: solo-logs
path: ~/.solo/logs/*
if-no-files-found: error