diff --git a/test/e2e-common.sh b/test/e2e-common.sh index f64dfe8b634..9ef60e70b8f 100755 --- a/test/e2e-common.sh +++ b/test/e2e-common.sh @@ -169,3 +169,24 @@ 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 + perl -p -e 's/gcr.io\/christiewilson-catfactory/$ENV{KO_DOCKER_REPO}/g' ${file} | ko delete -f - + perl -p -e 's/gcr.io\/christiewilson-catfactory/$ENV{KO_DOCKER_REPO}/g' ${file} | ko create -f - || return 1 + done +} \ No newline at end of file diff --git a/test/e2e-tests-upgrade.sh b/test/e2e-tests-upgrade.sh index 75b285642ab..b88eb71a9ef 100755 --- a/test/e2e-tests-upgrade.sh +++ b/test/e2e-tests-upgrade.sh @@ -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