github.com/proofpoint/helm@v2.7.2+incompatible/.circleci/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  # 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  
    26  VERSION=
    27  if [[ -n "${CIRCLE_TAG:-}" ]]; then
    28    VERSION="${CIRCLE_TAG}"
    29  elif [[ "${CIRCLE_BRANCH:-}" == "master" ]]; then
    30    VERSION="canary"
    31  else
    32    exit 1
    33  fi
    34  
    35  echo "Install docker client"
    36  VER="17.03.0-ce"
    37  curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
    38  tar -xz -C /tmp -f /tmp/docker-$VER.tgz
    39  mv /tmp/docker/* /usr/bin
    40  
    41  echo "Install gcloud components"
    42  export CLOUDSDK_CORE_DISABLE_PROMPTS=1
    43  curl https://sdk.cloud.google.com | bash
    44  ${HOME}/google-cloud-sdk/bin/gcloud --quiet components update
    45  
    46  echo "Configuring gcloud authentication"
    47  echo "${GCLOUD_SERVICE_KEY}" | base64 --decode > "${HOME}/gcloud-service-key.json"
    48  ${HOME}/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file "${HOME}/gcloud-service-key.json"
    49  ${HOME}/google-cloud-sdk/bin/gcloud config set project "${PROJECT_NAME}"
    50  docker login -e 1234@5678.com -u _json_key -p "$(cat ${HOME}/gcloud-service-key.json)" https://gcr.io
    51  
    52  echo "Building the tiller image"
    53  make docker-build VERSION="${VERSION}"
    54  
    55  echo "Pushing image to gcr.io"
    56  docker push "gcr.io/kubernetes-helm/tiller:${VERSION}"
    57  
    58  echo "Building helm binaries"
    59  make build-cross
    60  make dist checksum VERSION="${VERSION}"
    61  
    62  echo "Pushing binaries to gs bucket"
    63  ${HOME}/google-cloud-sdk/bin/gsutil cp ./_dist/* "gs://${PROJECT_NAME}"