github.com/migueleliasweb/helm@v2.6.1+incompatible/scripts/ci/deploy.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Copyright 2016 The Kubernetes Authors All rights reserved.
     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  : ${GCLOUD_SERVICE_KEY:?"GCLOUD_SERVICE_KEY environment variable is not set"}
    19  : ${PROJECT_NAME:?"PROJECT_NAME environment variable is not set"}
    20  
    21  VERSION=
    22  if [[ -n "${CIRCLE_TAG:-}" ]]; then
    23    VERSION="${CIRCLE_TAG}"
    24  elif [[ "${CIRCLE_BRANCH:-}" == "master" ]]; then
    25    VERSION="canary"
    26  else
    27    exit 1
    28  fi
    29  
    30  echo "Updating gcloud components"
    31  sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update
    32  
    33  echo "Configuring gcloud authentication"
    34  echo "${GCLOUD_SERVICE_KEY}" | base64 --decode > "${HOME}/gcloud-service-key.json"
    35  sudo /opt/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file "${HOME}/gcloud-service-key.json"
    36  sudo /opt/google-cloud-sdk/bin/gcloud config set project "${PROJECT_NAME}"
    37  docker login -e 1234@5678.com -u _json_key -p "$(cat ${HOME}/gcloud-service-key.json)" https://gcr.io
    38  
    39  echo "Building the tiller image"
    40  make docker-build VERSION="${VERSION}"
    41  
    42  echo "Pushing image to gcr.io"
    43  docker push "gcr.io/kubernetes-helm/tiller:${VERSION}"
    44  
    45  echo "Building helm binaries"
    46  make build-cross
    47  make dist checksum VERSION="${VERSION}"
    48  
    49  echo "Pushing binaries to gs bucket"
    50  sudo /opt/google-cloud-sdk/bin/gsutil cp ./_dist/* "gs://${PROJECT_NAME}"