github.com/bartle-stripe/trillian@v1.2.1/scripts/deploy_gce_ci.sh (about)

     1  #!/usr/bin/env bash
     2  #set -o pipefail
     3  #set -o errexit
     4  #set -o nounset
     5  #set -o xtrace
     6  
     7  DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
     8  
     9  export PROJECT_NAME=trillian-opensource-ci
    10  export CLUSTER_NAME=trillian-opensource-ci
    11  export REGION=us-central1
    12  export ZONE=us-central1-a
    13  export CONFIGMAP=trillian-opensource-ci.yaml
    14  
    15  gcloud --quiet config set project ${PROJECT_NAME}
    16  gcloud --quiet config set container/cluster ${CLUSTER_NAME}
    17  gcloud --quiet config set compute/zone ${ZONE}
    18  gcloud --quiet container clusters get-credentials ${CLUSTER_NAME}
    19  
    20  echo "Building docker images..."
    21  cd $GOPATH/src/github.com/google/trillian
    22  docker build --quiet -f examples/deployment/docker/log_server/Dockerfile -t gcr.io/${PROJECT_NAME}/log_server:${TRAVIS_COMMIT} .
    23  docker build --quiet -f examples/deployment/docker/log_signer/Dockerfile -t gcr.io/${PROJECT_NAME}/log_signer:${TRAVIS_COMMIT} .
    24  
    25  echo "Pushing docker images..."
    26  gcloud docker -- push gcr.io/${PROJECT_NAME}/log_server:${TRAVIS_COMMIT}
    27  gcloud docker -- push gcr.io/${PROJECT_NAME}/log_signer:${TRAVIS_COMMIT}
    28  
    29  echo "Tagging docker images..."
    30  gcloud --quiet container images add-tag gcr.io/${PROJECT_NAME}/log_server:${TRAVIS_COMMIT} gcr.io/${PROJECT_NAME}/log_server:latest
    31  gcloud --quiet container images add-tag gcr.io/${PROJECT_NAME}/log_signer:${TRAVIS_COMMIT} gcr.io/${PROJECT_NAME}/log_signer:latest
    32  
    33  echo "Updating jobs..."
    34  kubectl delete configmap deploy-config
    35  envsubst < ${DIR}/../examples/deployment/kubernetes/${CONFIGMAP} | kubectl create -f -
    36  
    37  envsubst < ${DIR}/../examples/deployment/kubernetes/trillian-log-deployment.yaml | kubectl apply -f -
    38  envsubst < ${DIR}/../examples/deployment/kubernetes/trillian-log-service.yaml | kubectl apply -f -
    39  envsubst < ${DIR}/../examples/deployment/kubernetes/trillian-log-signer-deployment.yaml | kubectl apply -f -
    40  envsubst < ${DIR}/../examples/deployment/kubernetes/trillian-log-signer-service.yaml | kubectl apply -f -
    41  kubectl set image deployment/trillian-logserver-deployment trillian-logserver=gcr.io/${PROJECT_NAME}/log_server:${TRAVIS_COMMIT}
    42  kubectl set image deployment/trillian-logsigner-deployment trillian-log-signer=gcr.io/${PROJECT_NAME}/log_signer:${TRAVIS_COMMIT}