Skip to content

Commit f82c903

Browse files
authored
Merge pull request #14 from konflux-ci/improve-intgr-test
Improve integration test
2 parents b559e11 + dd75909 commit f82c903

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

hack/integration-test/app/.tekton/ci-pipeline.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ spec:
1717
- name: kind
1818
value: task
1919
resolver: bundles
20-
- name: test
20+
- name: lint
2121
taskRef:
2222
params:
2323
- name: name
24-
value: test
24+
value: lint
2525
- name: bundle
26-
value: quay.io/mytestworkload/task-test:0.2@sha256:67890
26+
value: quay.io/mytestworkload/task-lint:0.2@sha256:67890
2727
- name: kind
2828
value: task
2929
resolver: bundles

hack/integration-test/setup.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ export QUAY_NAMESPACE
1010
declare -r DEFAULT_RECIPES="
1111
clone 0.2 -
1212
clone 0.2 M
13-
clone 0.2 -
1413
clone 0.2 M
1514
clone 0.2 -
16-
lint 0.2 -
17-
lint 0.2 M
18-
lint 0.2 M
1915
lint 0.2 M
2016
lint 0.2 -
2117
"
@@ -63,13 +59,25 @@ create_migration() {
6359

6460
local -r migration_file="${migration_dir}/${new_version}.sh"
6561

62+
local -r filename=${task_file##*/}
63+
local -r task_name=${filename%.*}
64+
6665
cat >"$migration_file" <<EOF
6766
#!/usr/bin/env bash
6867
set -euo pipefail
68+
6969
declare -r pipeline_file=\${1:?Missing pipeline file}
70+
declare -r history="Migration was created at $(date --iso-8601=s --utc)"
71+
declare -r params_selector='.spec.tasks[] | select(.name == "${task_name}") | .params'
72+
declare -r history_selector="\${params_selector}[] | select(.name == \"history\")"
73+
74+
if yq -e "\$history_selector" "\$pipeline_file" >/dev/null 2>&1
75+
then
76+
yq -i "(\${history_selector} | .value) += [\"\${history}\"]" "\$pipeline_file"
77+
else
78+
yq -i "(\${params_selector}) += [{\"name\": \"history\", \"value\": [\"\${history}\"]}]" "\$pipeline_file"
79+
fi
7080
71-
# Created at $(date)
72-
# Migration for task ${task_file##*/} and version ${new_version}
7381
EOF
7482
echo "$migration_file"
7583
}

0 commit comments

Comments
 (0)