gitea.ysmox.com/helm/helm@v2.17.0+incompatible/.circleci/deploy.sh (about) 1 #!/usr/bin/env bash 2 3 # Copyright The Helm Authors. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 set -euo pipefail 17 18 # Skip on pull request builds 19 if [[ -n "${CIRCLE_PR_NUMBER:-}" ]]; then 20 exit 21 fi 22 23 : ${GCLOUD_SERVICE_KEY:?"GCLOUD_SERVICE_KEY environment variable is not set"} 24 : ${PROJECT_NAME:?"PROJECT_NAME environment variable is not set"} 25 : ${AZURE_STORAGE_CONNECTION_STRING:?"AZURE_STORAGE_CONNECTION_STRING environment variable is not set"} 26 : ${AZURE_STORAGE_CONTAINER_NAME:?"AZURE_STORAGE_CONTAINER_NAME environment variable is not set"} 27 28 VERSION= 29 if [[ -n "${CIRCLE_TAG:-}" ]]; then 30 VERSION="${CIRCLE_TAG}" 31 else 32 # Canary version is used with helm init --canary-image flag. 33 # Does not push canary binary which is Helm v3. 34 VERSION="canary" 35 fi 36 37 echo "Install docker client" 38 VER="17.09.0-ce" 39 curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz 40 tar -xz -C /tmp -f /tmp/docker-$VER.tgz 41 mv /tmp/docker/* /usr/bin 42 43 echo "Install gcloud components" 44 export CLOUDSDK_CORE_DISABLE_PROMPTS=1 45 curl https://sdk.cloud.google.com | bash 46 ${HOME}/google-cloud-sdk/bin/gcloud --quiet components update 47 48 echo "Configuring GitHub Container Repository configuration" 49 echo ${GH_TOKEN_PUSH_TILLER} | docker login ghcr.io -u helm-bot --password-stdin 50 51 echo "Configuring gcloud authentication" 52 echo "${GCLOUD_SERVICE_KEY}" | base64 --decode > "${HOME}/gcloud-service-key.json" 53 ${HOME}/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file "${HOME}/gcloud-service-key.json" 54 ${HOME}/google-cloud-sdk/bin/gcloud config set project "${PROJECT_NAME}" 55 docker login -u _json_key -p "$(cat ${HOME}/gcloud-service-key.json)" https://gcr.io 56 57 echo "Configuring Docker Hub configuration" 58 echo ${DOCKER_PASS} | docker login -u ${DOCKER_USER} --password-stdin 59 60 # echo "Configuring Quay configuration" 61 echo ${QUAY_PASS} | docker login quay.io -u ${QUAY_USER} --password-stdin 62 63 echo "Building the tiller image" 64 make docker-build VERSION="${VERSION}" 65 66 # Image is pushed to GitHub container repository (ghcr.io), 67 # GCR, Docker Hub, and Quay. 68 echo "Pushing image to ghcr.io" 69 docker push "ghcr.io/helm/tiller:${VERSION}" 70 71 echo "Pushing image to gcr.io" 72 docker tag "ghcr.io/helm/tiller:${VERSION}" "gcr.io/kubernetes-helm/tiller:${VERSION}" 73 docker push "gcr.io/kubernetes-helm/tiller:${VERSION}" 74 75 echo "Pushing image to Docker Hub" 76 docker tag "ghcr.io/helm/tiller:${VERSION}" "helmpack/tiller:${VERSION}" 77 docker push "helmpack/tiller:${VERSION}" 78 79 echo "Pushing image to Quay" 80 docker tag "ghcr.io/helm/tiller:${VERSION}" "quay.io/helmpack/tiller:${VERSION}" 81 docker push "quay.io/helmpack/tiller:${VERSION}" 82 83 # Canary version is used with helm init --canary-image flag. 84 # Does not push canary binary which is Helm v3. 85 if [ "$VERSION" != "canary" ]; then 86 echo "Installing Azure CLI" 87 apt update 88 apt install -y apt-transport-https 89 echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ stretch main" | tee /etc/apt/sources.list.d/azure-cli.list 90 curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add 91 apt update 92 apt install -y azure-cli 93 94 echo "Building helm binaries" 95 make build-cross 96 make dist checksum VERSION="${VERSION}" 97 98 echo "Pushing binaries to gs bucket" 99 ${HOME}/google-cloud-sdk/bin/gsutil cp ./_dist/* "gs://${PROJECT_NAME}" 100 101 echo "Pushing binaries to Azure" 102 az storage blob upload-batch -s _dist/ -d "$AZURE_STORAGE_CONTAINER_NAME" --pattern 'helm-*' --connection-string "$AZURE_STORAGE_CONNECTION_STRING" 103 104 echo "Pushing KEYS file to Azure" 105 az storage blob upload -f "KEYS" -n "KEYS" -c "$AZURE_STORAGE_CONTAINER_NAME" --connection-string "$AZURE_STORAGE_CONNECTION_STRING" 106 fi