-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
51 lines (51 loc) · 2.27 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
50
51
language: bash
sudo: required
env:
global:
- OPENSSL_CMD="openssl aes-256-cbc -K $encrypted_debe730ce1aa_key -iv $encrypted_debe730ce1aa_iv -in ./k8s-ops-secret.json.enc -out ./secret-k8s-ops.json -d"
- OPS_REPO_SLUG=Beit-Hatfutsot/mojp-k8s
- OPS_REPO_BRANCH=master
- CLOUDSDK_CORE_PROJECT=bh-org-01
- PROJECT_NAME=mojp-dbs-pipelines
# --force causes helm to delete and recreate modified jobs
- HELM_UPGRADE_CMD="./helm_upgrade_external_chart.sh mojp-dbs-pipelines --force"
matrix:
- DEPLOY_ENVIRONMENT=staging DEPLOY_BRANCH=master
# - DEPLOY_ENVIRONMENT=production DEPLOY_TAGS=true
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 '{"'${PROJECT_NAME}'":{"image":"'${IMAGE_TAG}'"}}' | base64 -w0`
wget https://raw.githubusercontent.com/OriHoch/sk8s-ops/master/run_docker_ops.sh
chmod +x run_docker_ops.sh bin/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