From 1d8bfc6cbda3912c0376154a7cddb7d971831017 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Thu, 4 Nov 2021 10:24:45 +0100 Subject: [PATCH] =?UTF-8?q?Use=20./hack/feth-releases.sh=20for=20the=20rel?= =?UTF-8?q?ease=20task=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have an existing script that does fetch the release. Not using it in the release tasks is proving to be very error prone as the script might differ between the too, and thus we end up with broken releases (missing files, …) Signed-off-by: Vincent Demeester (cherry picked from commit cbcc09f94f264e30500a4907787c67b0f4055f43) Signed-off-by: Vincent Demeester --- tekton/task-fetch-components.yaml | 118 +----------------------------- 1 file changed, 2 insertions(+), 116 deletions(-) diff --git a/tekton/task-fetch-components.yaml b/tekton/task-fetch-components.yaml index 91151fc8f7..d73f4d6f1b 100644 --- a/tekton/task-fetch-components.yaml +++ b/tekton/task-fetch-components.yaml @@ -27,122 +27,8 @@ spec: workingDir: /go/src/github.com/tektoncd/operator script: | #!/usr/bin/env sh - - set -u -e -o pipefail - - SCRIPT_DIR=$(pwd) - TARGET="" - - # release_yaml - release_yaml() { - echo fetching: $* - local comp=$1 - local releaseFileName=$2 - local destFileName=$3 - local version=$4 - - # directory name => tekton- - # tekton-pipeline tekton-trigger - local dir=$1 - if [[ $comp == "triggers" ]]; then - dir="trigger" - fi - - if [[ $comp == "dashboard" ]]; then - if [[ ${releaseFileName} == "tekton-dashboard-release" ]]; then - dir="dashboard/tekton-dashboard-fullaccess" - fi - - if [[ ${releaseFileName} == "tekton-dashboard-release-readonly" ]]; then - dir="dashboard/tekton-dashboard-readonly" - fi - fi - - #nightly -> 0.0.0-nightly - #latest -> find version till then -> 0.0.0-latest - #version -> directory with version - - url="" - case $version in - nightly) - dirVersion="0.0.0-nightly" - url="https://storage.googleapis.com/tekton-releases-nightly/${comp}/latest/${releaseFileName}.yaml" - ;; - latest) - dirVersion="0.0.0-latest" - url="https://storage.googleapis.com/tekton-releases/${comp}/latest/${releaseFileName}.yaml" - ;; - *) - dirVersion=${version//v} - url="https://storage.googleapis.com/tekton-releases/${comp}/previous/${version}/${releaseFileName}.yaml" - ;; - esac - - ko_data=${SCRIPT_DIR}/cmd/${TARGET}/operator/kodata - comp_dir=${ko_data}/tekton-${dir} - - # before adding releases, remove existing version directories - # ignore while adding for interceptors - if [[ ${releaseFileName} != "interceptors" ]] ; then - rm -rf ${comp_dir}/* - fi - - # create a directory - dirPath=${comp_dir}/${dirVersion} - mkdir -p ${dirPath} || true - - # destination file - dest=${dirPath}/${destFileName}.yaml - http_response=$(curl -s -o ${dest} -w "%{http_code}" ${url}) - echo url: ${url} - - if [ $http_response != "200" ]; then - echo "Error: failed to get $comp yaml, status code: $http_response" - exit 1 - fi - - # Add OpenShift specific files for pipelines - if [[ ${TARGET} == "openshift" ]] && [[ ${comp} == "pipeline" ]]; then - cp -r ${ko_data}/openshift/00-prereconcile ${comp_dir}/ - cp ${ko_data}/openshift/pipelines-rbac/* ${dirPath}/ - fi - - - if [[ ${comp} == "dashboard" ]]; then - sed -i '/aggregationRule/,+3d' ${dest} - fi - - echo "Info: Added $comp/$releaseFileName:$version release yaml !!" - if [[ ${comp} == "results" ]]; then - grep 'version' ${dest} | head -n 1 | tr -d ' ' || true - else - grep 'app.kubernetes.io/version' ${dest} | head -n 1 | sed 's/[[:space:]]*app.kubernetes.io\///' || true - fi - } - - main() { - echo args: $* - pwd - echo :::::: - find cmd/$(params.TARGET_PLATFORM)/operator - echo ::::::: - TARGET=$1 - p_version=${2} - release_yaml pipeline release.notags 00-pipelines ${p_version} - - t_version=${3} - release_yaml triggers release.notags 00-triggers ${t_version} - release_yaml triggers interceptors.notags 01-interceptors ${t_version} - - d_version=${4} - release_yaml dashboard tekton-dashboard-release 00-dashboard ${d_version} - release_yaml dashboard tekton-dashboard-release-readonly 00-dashboard-readonly ${d_version} - - r_version=${5} - release_yaml results release 00-results ${r_version} - } - - main $(params.TARGET_PLATFORM) $(params.PIPELINES_VERSION) $(params.TRIGGERS_VERSION) $(params.DASHBOARD_VERSION) $(params.RESULTS_VERSION) + apk add bash # Bash is not present + ./hack/fetch-releases.sh $(params.TARGET_PLATFORM) $(params.PIPELINES_VERSION) $(params.TRIGGERS_VERSION) $(params.DASHBOARD_VERSION) $(params.RESULTS_VERSION) # print directory structure of cmd//operator/kodata find cmd/$(params.TARGET_PLATFORM)/operator/kodata/