-
Notifications
You must be signed in to change notification settings - Fork 12
/
.travis.yml
50 lines (50 loc) · 1.96 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
language: bash
sudo: required
env:
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}" ] && ! echo "${TRAVIS_COMMIT_MESSAGE}" | grep -- --no-deploy) ||\
([ "${DEPLOY_TAGS}" == "true" ] && [ "${TRAVIS_TAG}" != "" ]) \
)
then
openssl aes-256-cbc -K $encrypted_de69cc520442_key -iv $encrypted_de69cc520442_iv -in ./k8s-ops-secret.json.enc -out secret-k8s-ops.json -d
K8S_ENVIRONMENT_NAME="${DEPLOY_ENVIRONMENT}"
OPS_REPO_SLUG="Midburn/midburn-k8s"
OPS_REPO_BRANCH="${DEPLOY_BRANCH}"
cat secret-k8s-ops.json | docker login -u _json_key --password-stdin https://gcr.io
wget https://raw.githubusercontent.com/Midburn/midburn-k8s/master/run_docker_ops.sh
chmod +x run_docker_ops.sh
if ./run_docker_ops.sh "${K8S_ENVIRONMENT_NAME}" "
RES=0;
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh &&\
chmod 700 get_helm.sh &&\
./get_helm.sh --version v2.8.2;
if ./helm_upgrade_all.sh --install --dry-run --debug; then
echo Dry run was successfull, performing upgrades
! ./helm_upgrade_all.sh --install && echo Failed upgrade && RES=1
! ./helm_healthcheck.sh && echo Failed healthcheck && RES=1
else
echo Failed dry run
RES=1
fi
sleep 2;
kubectl get pods --all-namespaces;
kubectl get service --all-namespaces;
exit "'$'"RES
" "gcr.io/midbarrn/sk8s-ops" "${OPS_REPO_SLUG}" "${OPS_REPO_BRANCH}"; then
true
else
echo "failed to run docker ops"
false
fi
else
echo "skipping deployment"
true
fi