Skip to content

Commit 1f6c7e7

Browse files
authored
Merge pull request #689 from Roming22/ci-fix
Improve CI investigation
2 parents c7fd18e + 7f2b977 commit 1f6c7e7

File tree

7 files changed

+64
-26
lines changed

7 files changed

+64
-26
lines changed

.tekton/pipeline/acceptance-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,7 @@ spec:
122122
- name: target_branch
123123
value: $(params.target_branch)
124124
workspaces:
125+
- name: output
126+
workspace: shared-workspace
125127
- name: source
126128
workspace: source

.tekton/pipeline/stonesoup-integeration-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,7 @@ spec:
8787
- name: region
8888
value: $(params.aws_region)
8989
workspaces:
90+
- name: output
91+
workspace: shared-workspace
9092
- name: source
9193
workspace: source

.tekton/pipeline/upgrade-tests.yaml

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
- name: url
2727
value: $(params.repo_url)
2828
- name: revision
29-
value: $(params.target_branch)
29+
value: $(params.revision)
3030
- name: generate-cluster-name
3131
taskRef:
3232
name: generate-cluster-name
@@ -63,11 +63,24 @@ spec:
6363
workspace: source
6464
- name: kubeconfig-dir
6565
workspace: upgrade-shared-workspace
66-
- name: plnsvc-setup
66+
- name: clone-pipeline-service-git-baseline
67+
runAfter:
68+
- "setup-ci-runner"
69+
taskRef:
70+
name: git-clone
71+
workspaces:
72+
- name: output
73+
workspace: source
74+
params:
75+
- name: url
76+
value: $(params.repo_url)
77+
- name: revision
78+
value: $(params.target_branch)
79+
- name: plnsvc-setup-baseline
6780
taskRef:
6881
name: pipeline-service-setup
6982
runAfter:
70-
- "setup-ci-runner"
83+
- "clone-pipeline-service-git-baseline"
7184
workspaces:
7285
- name: kubeconfig-dir
7386
workspace: upgrade-shared-workspace
@@ -80,11 +93,11 @@ spec:
8093
value: $(params.revision)
8194
- name: target_branch
8295
value: $(params.target_branch)
83-
- name: tests-before-upgrade
96+
- name: tests-baseline
8497
taskRef:
8598
name: pipeline-service-tests
8699
runAfter:
87-
- "plnsvc-setup"
100+
- "plnsvc-setup-baseline"
88101
params:
89102
- name: target_branch
90103
value: $(params.target_branch)
@@ -93,9 +106,9 @@ spec:
93106
workspace: upgrade-shared-workspace
94107
- name: source
95108
workspace: source
96-
- name: clone-pipeline-service-git-for-upgrade
109+
- name: clone-pipeline-service-git-upgrade
97110
runAfter:
98-
- "tests-before-upgrade"
111+
- "tests-baseline"
99112
taskRef:
100113
name: git-clone
101114
workspaces:
@@ -106,11 +119,11 @@ spec:
106119
value: $(params.repo_url)
107120
- name: revision
108121
value: $(params.revision)
109-
- name: plnsvc-upgrade-setup
122+
- name: plnsvc-setup-upgrade
110123
taskRef:
111124
name: pipeline-service-upgrade-setup
112125
runAfter:
113-
- "clone-pipeline-service-git-for-upgrade"
126+
- "clone-pipeline-service-git-upgrade"
114127
workspaces:
115128
- name: kubeconfig-dir
116129
workspace: upgrade-shared-workspace
@@ -123,11 +136,11 @@ spec:
123136
value: $(params.revision)
124137
- name: target_branch
125138
value: $(params.target_branch)
126-
- name: tests-post-upgrade
139+
- name: tests-upgrade
127140
taskRef:
128141
name: pipeline-service-tests
129142
runAfter:
130-
- "plnsvc-upgrade-setup"
143+
- "plnsvc-setup-upgrade"
131144
params:
132145
- name: target_branch
133146
value: $(params.target_branch)
@@ -136,9 +149,9 @@ spec:
136149
workspace: upgrade-shared-workspace
137150
- name: source
138151
workspace: source
139-
- name: clone-pipeline-service-git-post-upgrade
152+
- name: clone-pipeline-service-git-downgrade
140153
runAfter:
141-
- "tests-post-upgrade"
154+
- "tests-upgrade"
142155
taskRef:
143156
name: git-clone
144157
workspaces:
@@ -149,11 +162,11 @@ spec:
149162
value: $(params.repo_url)
150163
- name: revision
151164
value: $(params.target_branch)
152-
- name: plnsvc-downgrade-setup
165+
- name: plnsvc-setup-downgrade
153166
taskRef:
154167
name: pipeline-service-upgrade-setup
155168
runAfter:
156-
- "clone-pipeline-service-git-post-upgrade"
169+
- "clone-pipeline-service-git-downgrade"
157170
workspaces:
158171
- name: kubeconfig-dir
159172
workspace: upgrade-shared-workspace
@@ -166,11 +179,11 @@ spec:
166179
value: $(params.revision)
167180
- name: target_branch
168181
value: $(params.target_branch)
169-
- name: tests-post-downgrade
182+
- name: tests-downgrade
170183
taskRef:
171184
name: pipeline-service-tests
172185
runAfter:
173-
- "plnsvc-downgrade-setup"
186+
- "plnsvc-setup-downgrade"
174187
params:
175188
- name: target_branch
176189
value: $(params.target_branch)
@@ -195,5 +208,7 @@ spec:
195208
- name: region
196209
value: $(params.aws_region)
197210
workspaces:
211+
- name: output
212+
workspace: upgrade-shared-workspace
198213
- name: source
199214
workspace: source

.tekton/tasks/destroy-cluster.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ spec:
1111
- name: target_branch
1212
workspaces:
1313
- name: source
14+
- name: output
1415
steps:
1516
- name: destroy
1617
image: quay.io/redhat-pipeline-service/ci-runner:$(params.target_branch)
@@ -32,6 +33,8 @@ spec:
3233
secretKeyRef:
3334
name: hypershift-bitwarden
3435
key: "BW_PASSWORD"
36+
- name: KUBECONFIG_DIR
37+
value: "$(workspaces.output.path)"
3538
- name: REGION
3639
value: "$(params.region)"
3740
workingDir: "$(workspaces.source.path)"

ci/images/ci-runner/hack/bin/create-ci-runner-container.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@ kubectl -n default apply -k "$MANIFEST_DIR/sidecar"
2222

2323
kubectl -n default wait pod/ci-runner --for=condition=Ready --timeout=90s
2424
kubectl -n default describe pod/ci-runner
25+
26+
echo
27+
echo "KUBECONFIG:"
28+
cat "$KUBECONFIG"
29+
echo
30+
echo "Connect to the ci-runner with: kubectl exec -n default --stdin --tty ci-runner -- bash"
31+
echo

ci/images/ci-runner/hack/bin/destroy-cluster.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@ SCRIPT_DIR="$(
1111

1212
# Give developers 15mins to connect to a pod and remove the file
1313
# if they want to investigate the failure
14-
if [ -e "$PWD/destroy-cluster.txt" ]; then
14+
failure_file="$PWD/destroy-cluster.txt"
15+
if [ -e "$failure_file" ]; then
16+
echo "Failure detected."
17+
echo "Delete '$failure_file' within 15 minutes to keep the cluster alive for investigation."
18+
echo
19+
echo "KUBECONFIG:"
20+
cat "$KUBECONFIG_DIR/$KUBECONFIG"
21+
echo
22+
echo "Connect to the ci-runner with: kubectl exec -n default --stdin --tty ci-runner -- bash"
23+
echo
24+
1525
sleep 900
16-
if [ -e "$PWD/destroy-cluster.txt" ]; then
26+
if [ -e "$failure_file" ]; then
1727
echo "Failure is not being investigated, cluster will be destroyed."
1828
else
19-
echo "KUBECONFIG:"
20-
cat "$KUBECONFIG"
21-
echo
22-
echo "Connect to the ci-runner: kubectl exec -n default --stdin --tty ci-runner -- bash"
23-
echo
2429
echo "Failure under investigation, cluster will not be destroyed."
2530
exit 1
2631
fi

ci/images/ci-runner/hack/sidecar/bin/plnsvc_test.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ echo "Start executing pipeline cases ..."
88
TEST_DIR=$(find "$PWD" -type f -name test.sh -exec dirname {} +)
99
"$TEST_DIR/test.sh" --kubeconfig "$KUBECONFIG"
1010

11-
# If the tests are successful, the cluster can be destroyed right away
12-
rm "$PWD/destroy-cluster.txt"
11+
12+
# In case the user deleted the file early when they expected a failure
13+
if [ -e "$PWD/destroy-cluster.txt" ]; then
14+
# If the tests are successful, the cluster can be destroyed right away
15+
rm "$PWD/destroy-cluster.txt"
16+
fi

0 commit comments

Comments
 (0)