@@ -27,28 +27,32 @@ outputs:
27
27
runs :
28
28
using : composite
29
29
steps :
30
- - name : Record Start Time
31
- id : start-time
32
- shell : bash
33
- run : |
34
- echo "START_TIME=$(date +'%Y-%m-%dT%H:%M:%S')" | tee -a "$GITHUB_OUTPUT"
35
-
36
30
- name : Extract Test and Instance Configuration
37
31
env :
38
32
TEST_PARAMETER : ${{ inputs.test-parameter }}
39
33
TEST_PLATFORM : ${{ inputs.test-platform }}
40
34
TEST_RUN : ${{ inputs.test-run }}
35
+ GITHUB_DEBUG : ${{ runner.debug }}
41
36
shell : bash
42
37
run : |
43
38
set -euo pipefail
39
+ [ -n "$GITHUB_DEBUG" ] && set -x
40
+
41
+ # Create and enter Python virtual env
42
+ python -m venv .venv
43
+ . .venv/bin/activate
44
+
45
+ # Install proper yq
46
+ pip install yq==3.4.3
47
+ yq --version
44
48
45
49
#####################################
46
50
# Extract Kubernetes-related Values #
47
51
#####################################
48
52
49
- export KUBERNETES_DISTRIBUTION=$(echo "$TEST_PLATFORM" | cut -d - -f 1)
50
- export KUBERNETES_VERSION=$(echo "$TEST_PLATFORM" | cut -d - -f 2)
51
- export KUBERNETES_ARCHITECTURE=$(echo "$TEST_PLATFORM" | cut -d - -f 3)
53
+ KUBERNETES_DISTRIBUTION=$(echo "$TEST_PLATFORM" | cut -d - -f 1)
54
+ KUBERNETES_VERSION=$(echo "$TEST_PLATFORM" | cut -d - -f 2)
55
+ KUBERNETES_ARCHITECTURE=$(echo "$TEST_PLATFORM" | cut -d - -f 3)
52
56
53
57
echo "KUBERNETES_DISTRIBUTION=$KUBERNETES_DISTRIBUTION" | tee -a "$GITHUB_ENV"
54
58
echo "KUBERNETES_VERSION=$KUBERNETES_VERSION" | tee -a "$GITHUB_ENV"
@@ -58,13 +62,19 @@ runs:
58
62
# Extract Instance Configuration #
59
63
##################################
60
64
61
- export INSTANCE_SIZE=$(yq '.instance-size' -e ./tests/infrastructure.yaml)
62
- INSTANCE_TYPE=$(yq '.[env(KUBERNETES_DISTRIBUTION)].[env(KUBERNETES_ARCHITECTURE)].[env(INSTANCE_SIZE)]' -e "$GITHUB_ACTION_PATH/instances.yml")
65
+ INSTANCE_SIZE=$(yq -er '."instance-size"' ./tests/infrastructure.yaml)
66
+ INSTANCE_TYPE=$(yq -er \
67
+ --arg kubernetes_distribution "$KUBERNETES_DISTRIBUTION" \
68
+ --arg kubernetes_architecture "$KUBERNETES_ARCHITECTURE" \
69
+ --arg instance_size "$INSTANCE_SIZE" \
70
+ '.[$kubernetes_distribution][$kubernetes_architecture][$instance_size]' \
71
+ "$GITHUB_ACTION_PATH/instances.yml"
72
+ )
63
73
64
74
# Optional config options
65
- CLUSTER_TTL=$(yq '. cluster-ttl' -e ./tests/infrastructure.yaml || echo "4h" )
66
- INSTANCE_NODES=$(yq '.nodes' -e ./tests/infrastructure.yaml || echo "1" )
67
- INSTANCE_DISK=$(yq '.disk' -e ./tests/infrastructure.yaml|| echo "50" )
75
+ CLUSTER_TTL=$(yq -er '." cluster-ttl" // "4h"' ./tests/infrastructure.yaml)
76
+ INSTANCE_NODES=$(yq -er '.nodes // 1' ./tests/infrastructure.yaml)
77
+ INSTANCE_DISK=$(yq -er '.disk // 50' ./tests/infrastructure.yaml)
68
78
69
79
echo "INSTANCE_TYPE=$INSTANCE_TYPE" | tee -a "$GITHUB_ENV"
70
80
echo "CLUSTER_TTL=$CLUSTER_TTL" | tee -a "$GITHUB_ENV"
87
97
fi
88
98
89
99
if [ "$TEST_RUN" == "test-suite" ]; then
90
- yq '.suites[] | select(.name == env(TEST_PARAMETER))' -e ./tests/test-definition.yaml
100
+ yq -er --arg test_parameter "$TEST_PARAMETER" '.suites[] | select(.name == $test_parameter)' ./tests/test-definition.yaml
91
101
elif [ "$TEST_RUN" == "test" ]; then
92
- yq '.tests[] | select(.name == env(TEST_PARAMETER))' -e ./tests/test-definition.yaml
102
+ yq -er --arg test_parameter "$TEST_PARAMETER" '.tests[] | select(.name == $test_parameter)' ./tests/test-definition.yaml
93
103
fi
94
104
fi
95
105
@@ -189,6 +199,12 @@ runs:
189
199
sudo apt install -y \
190
200
gettext-base
191
201
202
+ - name : Record Test Start Time
203
+ id : start-time
204
+ shell : bash
205
+ run : |
206
+ echo "START_TIME=$(date +'%Y-%m-%dT%H:%M:%S')" | tee -a "$GITHUB_OUTPUT"
207
+
192
208
- name : Run Integration Test (${{ inputs.test-run }}=${{ inputs.test-parameter }})
193
209
env :
194
210
REF_NAME : ${{ github.ref_name }}
@@ -206,6 +222,13 @@ runs:
206
222
python ./scripts/run-tests --skip-release --log-level debug "--$TEST_RUN" "$TEST_PARAMETER"
207
223
fi
208
224
225
+ - name : Record Test End Time
226
+ id : end-time
227
+ if : always()
228
+ shell : bash
229
+ run : |
230
+ echo "END_TIME=$(date +'%Y-%m-%dT%H:%M:%S')" | tee -a "$GITHUB_OUTPUT"
231
+
209
232
- name : Destroy Replicated Cluster
210
233
if : env.KUBERNETES_DISTRIBUTION != 'ionos' && always()
211
234
# If the creation of the cluster failed, we don't want to error and abort
@@ -215,10 +238,3 @@ runs:
215
238
# See: https://github.com/replicatedhq/replicated-actions/tree/main/remove-cluster#inputs
216
239
api-token : ${{ inputs.replicated-api-token }}
217
240
cluster-id : ${{ steps.prepare-replicated-cluster.outputs.cluster-id }}
218
-
219
- - name : Record End Time
220
- id : end-time
221
- if : always()
222
- shell : bash
223
- run : |
224
- echo "END_TIME=$(date +'%Y-%m-%dT%H:%M:%S')" | tee -a "$GITHUB_OUTPUT"
0 commit comments