-
Notifications
You must be signed in to change notification settings - Fork 3
/
.travis.yml
49 lines (49 loc) · 2.12 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
language: bash
sudo: required
env:
global:
- OPENSSL_CMD="openssl aes-256-cbc -K $encrypted_fe4f163623ce_key -iv $encrypted_fe4f163623ce_iv -in ./k8s-ops-secret.json.enc -out ./secret-k8s-ops.json -d"
- OPS_REPO_SLUG=Midburn/midburn-k8s
- OPS_REPO_BRANCH=master
- CLOUDSDK_CORE_PROJECT=midbarrn
- PROJECT_NAME=midburn-camps-index
matrix:
- DEPLOY_ENVIRONMENT=production DEPLOY_TAGS=true
- DEPLOY_ENVIRONMENT=staging DEPLOY_BRANCH=master
services:
- docker
script:
- |
if [ "${DEPLOY_ENVIRONMENT}" != "" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ] &&\
([ "${TRAVIS_BRANCH}" == "${DEPLOY_BRANCH}" ] || ([ "${DEPLOY_TAGS}" == "true" ] && [ "${TRAVIS_TAG}" != "" ])) &&\
! echo "${TRAVIS_COMMIT_MESSAGE}" | grep -- --no-deploy
then
$OPENSSL_CMD
if [ "${TRAVIS_TAG}" != "" ]; then
IMAGE_TAG="gcr.io/${CLOUDSDK_CORE_PROJECT}/${PROJECT_NAME}-tag:${TRAVIS_TAG}"
else
IMAGE_TAG="gcr.io/${CLOUDSDK_CORE_PROJECT}/${PROJECT_NAME}-cd:${TRAVIS_COMMIT}"
fi
B64_UPDATE_VALUES=`echo '{"camps-index":{"image":"'${IMAGE_TAG}'"}}' | base64 -w0`
wget https://raw.githubusercontent.com/OriHoch/sk8s-ops/master/run_docker_ops.sh
chmod +x run_docker_ops.sh continuous_deployment.sh
if ./run_docker_ops.sh "${DEPLOY_ENVIRONMENT}" "/pwd/continuous_deployment.sh" \
"orihoch/sk8s-ops" "${OPS_REPO_SLUG}" "${OPS_REPO_BRANCH}" "" "
-v `pwd`:/pwd
-e B64_UPDATE_VALUES=${B64_UPDATE_VALUES}
-e K8S_OPS_GITHUB_REPO_TOKEN=${K8S_OPS_GITHUB_REPO_TOKEN}
-e OPS_REPO_SLUG=${OPS_REPO_SLUG}
-e OPS_REPO_BRANCH=${OPS_REPO_BRANCH}
-e B64_UPDATE_VALUES=${B64_UPDATE_VALUES}
-e IMAGE_TAG=${IMAGE_TAG}
-e CLOUDSDK_CORE_PROJECT=${CLOUDSDK_CORE_PROJECT}
-e PROJECT_NAME=${PROJECT_NAME}"; then
true
else
echo "failed to run docker ops"
false
fi
else
echo "skipping deployment"
true
fi