Skip to content

Commit

Permalink
Restore apply_resources for scenario2 of upgrade test
Browse files Browse the repository at this point in the history
Scenario 2 of the upgrade test aims to install pipeline server from the
preivous release, create resources from that version and test on those
resources against the client of the current release.

This commit restores the apply_resources function to enable the 2nd
scenario of the upgrade test work by applying the resources from the old
server version of pipeline. It was preivously renamed and removed in
tektoncd#2685.

It fixes the missing piece where the required resources from the previous
release have not been created to accomplish scenario 2 of the upgrade
test. More specifically, it creates resources in v1 examples that are
not under beta or no-ci.

part of: tektoncd#5193
  • Loading branch information
JeromeJu committed Jun 23, 2023
1 parent f520f30 commit 1054d90
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,26 @@ function delete_pipeline_resources() {
function delete_resolvers_resources() {
kubectl delete --ignore-not-found=true resolutionrequests.resolution.tekton.dev --all
}

# apply_resources uses ko to first delete all the v1 non-beta and non-no-ci examples in the
# current namespace to prevent creating examples that already exists and then to ko create
# all in the examples file path.
function apply_resources() {
local resource=$1
path=${REPO_ROOT_DIR}/examples/v1
if ! [ -d ${path} ]; then
fail_test
fi

echo ">> Applying the resource ${resource}"
# Applying the resources, either *taskruns or * *pipelineruns
for file in $(find ${path}/${resource}s/ -name *.yaml | sort); do
if [[ ${file} =~ 'no-ci' || ${file} =~ 'beta' ]]; then
continue
fi
echo "deleting existent resources ${file}"
perl -p -e 's/gcr.io\/christiewilson-catfactory/$ENV{KO_DOCKER_REPO}/g' ${file} | ko delete -f -
echo "creating existent resources ${file}"
perl -p -e 's/gcr.io\/christiewilson-catfactory/$ENV{KO_DOCKER_REPO}/g' ${file} | ko create -f - || return 1
done
}
7 changes: 7 additions & 0 deletions test/e2e-tests-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ uninstall_pipeline_crd_version $PREVIOUS_PIPELINE_VERSION
header "Install the previous release of Tekton pipeline $PREVIOUS_PIPELINE_VERSION"
install_pipeline_crd_version $PREVIOUS_PIPELINE_VERSION

# Create the resources of taskrun and pipelinerun, under the directories example/taskrun
# and example/pipelinerun.
for test in taskrun pipelinerun; do
header "Applying the resources ${test}s"
apply_resources ${test}
done

# Upgrade to the current release.
header "Upgrade to the current release of Tekton pipeline"
install_pipeline_crd
Expand Down

0 comments on commit 1054d90

Please sign in to comment.