Skip to content

Commit

Permalink
Use ./hack/feth-releases.sh for the release task…
Browse files Browse the repository at this point in the history
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 <vdemeest@redhat.com>
(cherry picked from commit cbcc09f)
Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester committed Nov 4, 2021
1 parent 043d9bc commit 1d8bfc6
Showing 1 changed file with 2 additions and 116 deletions.
118 changes: 2 additions & 116 deletions tekton/task-fetch-components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <component> <release-yaml-name> <target-file-name> <version>
release_yaml() {
echo fetching: $*
local comp=$1
local releaseFileName=$2
local destFileName=$3
local version=$4
# directory name => tekton-<component>
# 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/<target-platform>/operator/kodata
find cmd/$(params.TARGET_PLATFORM)/operator/kodata/
Expand Down

0 comments on commit 1d8bfc6

Please sign in to comment.