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/