Skip to content

Commit 573268b

Browse files
Roming22xinredhat
authored andcommitted
Fix upgrade-tests pipeline
The wrong set of scripts were used when deploying/testing the baseline branch. Scripts from the baseline branch are now used when testing the baseline branch, and scripts from the PR are used when testing the PR branch. However CI related scripts always use the source branch, so that any changes in the CI scripts and/or pipeline definitions work as expected. * Fix issue with a sidecar script that was not called from the sidecar. * Change target of source code copy to /workspace/source on the sidecar * Copy sidecar scripts to /workspace/sidecar on the sidecar * Checkout the revision being tested before setup and test * Rename ci-runner-container-setup.yaml to setup-ci-runner-container.yaml so filename and taskname match Signed-off-by: Romain Arnaud <[email protected]>
1 parent 2a88f02 commit 573268b

14 files changed

+47
-113
lines changed

.tekton/pipeline-service-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
pipelinesascode.tekton.dev/on-event: "[pull_request, push]"
88
pipelinesascode.tekton.dev/on-target-branch: "[refs/heads/*]"
99
pipelinesascode.tekton.dev/pipeline: "[.tekton/pipeline/acceptance-tests.yaml]"
10-
pipelinesascode.tekton.dev/task: "[.tekton/tasks/ci-runner-container-setup.yaml]"
10+
pipelinesascode.tekton.dev/task: "[.tekton/tasks/setup-ci-runner-container.yaml]"
1111
pipelinesascode.tekton.dev/task-1: "[.tekton/tasks/deploy-cluster.yaml]"
1212
pipelinesascode.tekton.dev/task-2: "[.tekton/tasks/destroy-cluster.yaml]"
1313
pipelinesascode.tekton.dev/task-3: "[.tekton/tasks/destroy-existing-cluster.yaml]"

.tekton/pipeline-service-upgrade-test.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ metadata:
77
pipelinesascode.tekton.dev/on-event: "[pull_request, push]"
88
pipelinesascode.tekton.dev/on-target-branch: "[refs/heads/*]"
99
pipelinesascode.tekton.dev/pipeline: "[.tekton/pipeline/upgrade-tests.yaml]"
10-
pipelinesascode.tekton.dev/task: "[.tekton/tasks/ci-runner-container-setup.yaml]"
10+
pipelinesascode.tekton.dev/task: "[.tekton/tasks/setup-ci-runner-container.yaml]"
1111
pipelinesascode.tekton.dev/task-1: "[.tekton/tasks/deploy-cluster.yaml]"
1212
pipelinesascode.tekton.dev/task-2: "[.tekton/tasks/destroy-cluster.yaml]"
1313
pipelinesascode.tekton.dev/task-3: "[.tekton/tasks/destroy-existing-cluster.yaml]"
1414
pipelinesascode.tekton.dev/task-4: "[.tekton/tasks/generate-cluster-name.yaml]"
1515
pipelinesascode.tekton.dev/task-5: "[.tekton/tasks/pipeline-service-setup.yaml]"
1616
pipelinesascode.tekton.dev/task-6: "[.tekton/tasks/pipeline-service-tests.yaml]"
17-
pipelinesascode.tekton.dev/task-7: "[.tekton/tasks/pipeline-service-upgrade-setup.yaml]"
18-
pipelinesascode.tekton.dev/task-8: "[git-clone]"
17+
pipelinesascode.tekton.dev/task-7: "[git-clone]"
1918
pipelinesascode.tekton.dev/max-keep-runs: "5"
2019
spec:
2120
pipelineRef:

.tekton/pipeline/acceptance-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ spec:
8989
params:
9090
- name: repo_url
9191
value: $(params.repo_url)
92-
- name: revision
93-
value: $(params.revision)
9492
- name: target_branch
9593
value: $(params.target_branch)
94+
- name: test_branch
95+
value: $(params.revision)
9696
- name: pipeline-service-tests
9797
taskRef:
9898
name: pipeline-service-tests

.tekton/pipeline/upgrade-tests.yaml

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,11 @@ spec:
6363
workspace: source
6464
- name: kubeconfig-dir
6565
workspace: upgrade-shared-workspace
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)
7966
- name: plnsvc-setup-baseline
8067
taskRef:
8168
name: pipeline-service-setup
8269
runAfter:
83-
- "clone-pipeline-service-git-baseline"
70+
- "setup-ci-runner"
8471
workspaces:
8572
- name: kubeconfig-dir
8673
workspace: upgrade-shared-workspace
@@ -89,10 +76,10 @@ spec:
8976
params:
9077
- name: repo_url
9178
value: $(params.repo_url)
92-
- name: revision
93-
value: $(params.revision)
9479
- name: target_branch
9580
value: $(params.target_branch)
81+
- name: test_branch
82+
value: $(params.target_branch)
9683
- name: tests-baseline
9784
taskRef:
9885
name: pipeline-service-tests
@@ -106,24 +93,11 @@ spec:
10693
workspace: upgrade-shared-workspace
10794
- name: source
10895
workspace: source
109-
- name: clone-pipeline-service-git-upgrade
110-
runAfter:
111-
- "tests-baseline"
112-
taskRef:
113-
name: git-clone
114-
workspaces:
115-
- name: output
116-
workspace: source
117-
params:
118-
- name: url
119-
value: $(params.repo_url)
120-
- name: revision
121-
value: $(params.revision)
12296
- name: plnsvc-setup-upgrade
12397
taskRef:
124-
name: pipeline-service-upgrade-setup
98+
name: pipeline-service-setup
12599
runAfter:
126-
- "clone-pipeline-service-git-upgrade"
100+
- "tests-baseline"
127101
workspaces:
128102
- name: kubeconfig-dir
129103
workspace: upgrade-shared-workspace
@@ -132,10 +106,10 @@ spec:
132106
params:
133107
- name: repo_url
134108
value: $(params.repo_url)
135-
- name: revision
136-
value: $(params.revision)
137109
- name: target_branch
138110
value: $(params.target_branch)
111+
- name: test_branch
112+
value: $(params.revision)
139113
- name: tests-upgrade
140114
taskRef:
141115
name: pipeline-service-tests
@@ -149,24 +123,11 @@ spec:
149123
workspace: upgrade-shared-workspace
150124
- name: source
151125
workspace: source
152-
- name: clone-pipeline-service-git-downgrade
153-
runAfter:
154-
- "tests-upgrade"
155-
taskRef:
156-
name: git-clone
157-
workspaces:
158-
- name: output
159-
workspace: source
160-
params:
161-
- name: url
162-
value: $(params.repo_url)
163-
- name: revision
164-
value: $(params.target_branch)
165126
- name: plnsvc-setup-downgrade
166127
taskRef:
167-
name: pipeline-service-upgrade-setup
128+
name: pipeline-service-setup
168129
runAfter:
169-
- "clone-pipeline-service-git-downgrade"
130+
- "tests-upgrade"
170131
workspaces:
171132
- name: kubeconfig-dir
172133
workspace: upgrade-shared-workspace
@@ -175,10 +136,10 @@ spec:
175136
params:
176137
- name: repo_url
177138
value: $(params.repo_url)
178-
- name: revision
179-
value: $(params.revision)
180139
- name: target_branch
181140
value: $(params.target_branch)
141+
- name: test_branch
142+
value: $(params.target_branch)
182143
- name: tests-downgrade
183144
taskRef:
184145
name: pipeline-service-tests

.tekton/tasks/pipeline-service-setup.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ metadata:
66
spec:
77
params:
88
- name: repo_url
9-
- name: revision
109
- name: target_branch
10+
- name: test_branch
1111
workspaces:
1212
- name: kubeconfig-dir
1313
description: The kubeconfig of new cluster will be stored onto the volume backing this Workspace
@@ -26,6 +26,6 @@ spec:
2626
- name: REPO_URL
2727
value: $(params.repo_url)
2828
- name: REPO_REVISION
29-
value: $(params.revision)
29+
value: $(params.test_branch)
3030
command:
3131
- ci/images/ci-runner/hack/bin/run-plnsvc-setup.sh

.tekton/tasks/pipeline-service-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ spec:
2121
- name: KUBECONFIG
2222
value: "$(workspaces.kubeconfig-dir.path)/kubeconfig"
2323
command:
24-
- ci/images/ci-runner/hack/sidecar/bin/plnsvc_test.sh
24+
- ci/images/ci-runner/hack/bin/run-plnsvc-test.sh

.tekton/tasks/pipeline-service-upgrade-setup.yaml

Lines changed: 0 additions & 43 deletions
This file was deleted.

ci/images/ci-runner/hack/bin/copy-plnsvc-code.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ set -o pipefail
55
set -x
66

77
echo "Copy source code of pipeline service to the ci-runner container"
8-
kubectl cp "./" "default/ci-runner:/source"
8+
kubectl cp "./" "default/ci-runner:/workspace/source"
9+
10+
echo "Copy sidecar sources to the ci-runner container"
11+
kubectl cp "./ci/images/ci-runner/hack/sidecar" "default/ci-runner:/workspace/sidecar"
912

1013
echo "Copy new cluster's kubeconfig to the ci-runner container"
1114
kubectl cp "$KUBECONFIG" "default/ci-runner:/kubeconfig"

ci/images/ci-runner/hack/bin/run-plnsvc-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ touch "$PWD/destroy-cluster.txt"
99

1010
echo "Execute dev_setup.sh script to set up pipeline-service ..."
1111
kubectl -n default exec pod/ci-runner -- \
12-
sh -c "/source/ci/images/ci-runner/hack/sidecar/bin/plnsvc_setup.sh $REPO_URL $REPO_REVISION"
12+
sh -c "/workspace/sidecar/bin/plnsvc_setup.sh $REPO_URL $REPO_REVISION"

0 commit comments

Comments
 (0)