Skip to content
This repository has been archived by the owner on Apr 24, 2018. It is now read-only.

Commit

Permalink
Merge pull request #2 from CommercialTribe/develop
Browse files Browse the repository at this point in the history
new staging
  • Loading branch information
jwaldrip committed Mar 16, 2017
2 parents b5b275d + 25f01c9 commit 6845011
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
33 changes: 21 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,40 @@ env:
global:
- CLOUDSDK_CONTAINER_USE_CLIENT_CERTIFICATE=True
before_deploy:
# Authorize with gcloud
- >
if [[ -n "$TRAVIS_TAG" ]] ; then
echo $GCLOUD_ENCODED_CREDS | base64 -d > /tmp/gcloud.json &&
gcloud auth activate-service-account $(jq -r ".client_email" /tmp/gcloud.json) --key-file=/tmp/gcloud.json &&
gcloud container clusters get-credentials production --project=commercial-tribe --zone=us-east1-c;
else
echo $GCLOUD_ENCODED_STAGING_CREDS | base64 -d > /tmp/gcloud.json &&
gcloud auth activate-service-account $(jq -r ".client_email" /tmp/gcloud.json) --key-file=/tmp/gcloud.json &&
gcloud container clusters get-credentials staging --project=commercial-tribe-staging --zone=us-central1-a;
fi
# Install and configure kubectl
- CLOUDSDK_CORE_DISABLE_PROMPTS=true sudo gcloud components update kubectl --version 142.0.0
- export PATH=$PATH:/usr/lib/google-cloud-sdk/bin
- export PATH=/usr/lib/google-cloud-sdk/bin:$PATH
- sudo chown -R $USER /home/travis/.config/gcloud
- echo $GCLOUD_ENCODED_CREDS | base64 -d > /tmp/gcloud.json
- gcloud auth activate-service-account $(jq -r ".client_email" /tmp/gcloud.json) --key-file=/tmp/gcloud.json
- gcloud config set project commercial-tribe
- gcloud config set compute/zone us-east1-c
- gcloud container clusters get-credentials staging
- gcloud container clusters get-credentials production
- git fetch

# Authorize docker for access to gcloud
- gcloud docker --authorize-only
deploy:
- provider: script
script: ./build-and-push.sh
on:
branch: master
- provider: script
script: ./deploy.sh develop gke_commercial-tribe_us-east1-c_staging
script: ./deploy.sh gke_commercial-tribe-staging_us-central1-a_staging develop
on:
branch: develop
- provider: script
script: ./deploy.sh staging gke_commercial-tribe_us-east1-c_staging
script: ./deploy.sh gke_commercial-tribe-staging_us-central1-a_staging staging
on:
branch: master
- provider: script
script: ./deploy.sh production gke_commercial-tribe_us-east1-c_production
script: ./deploy.sh gke_commercial-tribe_us-east1-c_production production
on:
tags: true
condition: $TRAVIS_TAG =~ ^v20.*$
condition: $TRAVIS_TAG =~ ^v20[0-9]{2}\.[1-4]\.[1-6]\.[0-9]+$
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
kubectl --namespace="$1" --context="$2" ${ACTION-"apply"} -Rf=./k8s
kubectl --context="$1" --namespace="$2" apply -Rf=./k8s --force
1 change: 1 addition & 0 deletions k8s/redis-node-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ spec:
name: data
annotations:
volume.beta.kubernetes.io/storage-class: "ssd"
gcp-auto-snapshot: "true"
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
Expand Down

0 comments on commit 6845011

Please sign in to comment.