-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
61 lines (55 loc) · 3.31 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
52
53
54
55
56
57
58
59
60
61
sudo: required
language: python
- 3.6
services:
- docker
env:
global:
- DOCKER_USER="thenomemac" # DOCKER_USER
- secure: "eua4yMd9g9hemu58/SKSXS9NqZ8VM6G76G9d+RHzCINhE6DPRefG35FmCzTwcp1FrUui0t6/dUKPXZZ1+iKrZWzyK48EW5EOiMz/6wlHksQ2B+t27BvGoNrnUZyhlUvkJK0bUalMcl4OrvMQHMAoMNmU5uZLv3W1AV2xAzESSPLNGb1cz1QQj8jMVXveEUMQKYoTqP/XqbGXSM0QH1eVAs7kjjXGW1G512dULeSCmNZf3XEjIVS9nZJC4ywfVtYs0pEF0JdyHYFk/+zgx8DRDzhVVz4f6/0TT06BqjYXeKXdJxqRPQbMtGycEsr5aB4HLZWXTNinzWGO5leYOVYtSMK3n0NPCl1EHPxqysi3B9wDeb1GGKEhKWrcjN315zCsfqOMeTtCp/yftvAccRx3gL5AY8c8PRQwQPTDLoczjMIuM4hdHWFgoImk4QpzgkmHA5Vw6p3aWULmWKbftjtQr6ZFEmDWFTZYI4bewQBJ3VK2QuhG0Q+ieK4FG7J6BGCrT4KLxWaF75yqjOzubgr+J1rjBFY4CCu2M61yTC1gSc19l4vevU7FVGFke93lLiua4/h1W38lX4gCJzgsiDAq6RfKDFS45hyXRPex1oSnrbCq42f+kAzOF8C5JCFrQ/tZIuyV8gddbgXWdoFt37kAe4OHz+X2ybtvBGrfV/Hoi1o=" # DOCKER_PASS
- COMMIT=${TRAVIS_COMMIT::7}
- REPO="thenomemac/fishapp"
before_install:
- openssl aes-256-cbc -K $encrypted_ac878f868f1c_key -iv $encrypted_ac878f868f1c_iv -in fishr-e76393bf4b15.secret.enc -out ./fishr-e76393bf4b15.secret -d
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- docker --version
- docker pull $REPO:$TAG
- docker build -f Dockerfile -t $REPO:$COMMIT .
- echo "$REPO:$COMMIT $REPO:$TAG"
- docker tag $REPO:$COMMIT $REPO:$TAG
- echo "$REPO:$COMMIT $REPO:travis-$TRAVIS_BUILD_NUMBER"
- docker tag $REPO:$COMMIT $REPO:travis-$TRAVIS_BUILD_NUMBER
- docker run -d -p 8000:8000 $REPO:$TAG /bin/bash -c "echo 'build done'";
- docker ps -a
script:
- echo 'hello testing world'
- docker run $REPO:$TAG python test_fishapp.py
after_success:
- echo 'after so much success'
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- docker push $REPO
- mkdir -p bin
- curl -L https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl > bin/kubectl
- chmod +x bin/kubectl
- export PATH="$(pwd)/bin:$PATH"
- export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
- echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
- curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
- sudo apt-get update && sudo apt-get install -y google-cloud-sdk kubectl
- gcloud auth activate-service-account --key-file="fishr-e76393bf4b15.secret"
- gcloud container clusters get-credentials cluster-1 --zone us-central1-a --project arboreal-retina-175212
- kubectl get pods --all-namespaces -o wide
- sed "s/\:latest/\:$COMMIT/g" kubernetes/fishapp-deployment.yaml | kubectl --namespace=dev apply -f -
- sleep 60
- kubectl get pods --namespace=dev
- devpodname=$(kubectl get pods --namespace=dev | grep 'Running' | tail -n1 | sed -e 's/\s.*$//')
- echo "$devpodname"
- kubectl proxy &
- intvar=$(curl -s "http://127.0.0.1:8001/api/v1/namespaces/dev/pods/$devpodname/proxy/" | grep 'WhatIsMyFish.net')
- echo "$intvar"
- if [[ "$intvar" = "" ]]; then echo 'failure'; else echo 'success'; fi
- sed "s/\:latest/\:$COMMIT/g" kubernetes/fishapp-deployment.yaml | kubectl apply -f -
- kubectl apply -f kubernetes/fishapp-service.yaml
- kubectl describe deployment fishapp
- kubectl get pods -o wide
- kubectl describe service fishapp