-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
166 lines (154 loc) · 5.33 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
notifications:
email: false
language: java
rvm: 2.6.4
python: 3
go: 1.13
service:
- docker
addons:
apt:
update: true
packages:
- sudo
- lsof
- wget
- bash
- curl
- jq
- python3-dev
- python3-pip
- python3-six
- python3-setuptools
- docker-ce
install: true
before_install:
- export PATH=$HOME/.local/bin:$PATH
- pip3 install --user $(whoami) --upgrade pip >/dev/null # pip3 -> pip
- pip install --user $(whoami) --upgrade docker-compose httpie >/dev/null 2>&1
#- http --version --debug
#- docker-compose -v
- source <(curl -s https://raw.githubusercontent.com/daggerok/bash-functions/master/main.bash)
- stop_any 80 8080 5432
stages:
- test
- deploy
jobs:
include:
- stage: test
jdk: openjdk8
name: tests jdk8
script:
- ./mvnw
- java -jar webapp/target/*.jar &
- wait_for 8080
- http get :8080
- http post :8080/maksimko
- stop_any 80 8080
- stage: test
jdk: openjdk11
name: tests jdk11
script:
- ./mvnw
- java -jar webapp/target/*.jar &
- wait_for 8080
- http get :8080
- http post :8080/maksimko
- stop_any 80 8080
- stage: test
jdk: openjdk8
name: docker tests jdk8
script:
- function wait_healthy_docker_containers {
n=${1:-1} ;
while [[ $(docker ps -n ${n} -q -f health=healthy -f status=running | wc -l) -lt ${n} ]] ; do
sleep 1s ;
echo -ne '.' ;
done ;
echo '' ;
}
- ./mvnw >/dev/null
- docker build -t daggerok/webapp -f docker/Dockerfile webapp
- stop_any 80 8080
- docker run -i --rm --name run-webapp -p 8080:8080 daggerok/webapp &
- sleep 1s
- docker logs -f -t run-webapp &
- wait_healthy_docker_containers 1
- http get :8080
- http post :8080/maksimko
- docker rm -f -v run-webapp
- stop_any 80 8080
- stage: test
go: 1.13
jdk: openjdk11
name: kind (k8s in docker) tests jdk11
script:
- stop_any 80 8080
- mkdir -p "$HOME/.local/bin"
- export PATH="$HOME/.local/bin:$PATH"
- curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
- chmod +x kubectl
- mv -vf kubectl $HOME/.local/bin/
- curl -Lo kind https://github.com/kubernetes-sigs/kind/releases/download/v0.5.1/kind-linux-amd64
- chmod +x kind
- mv -vf kind $HOME/.local/bin/
#
- kind create cluster
#- kind create cluster --image "kindest/node:v1.13.3"
- export KUBECONFIG=$(kind get kubeconfig-path)
- KUBECONFIG=$(kind get kubeconfig-path) kubectl get nodes
- kubectl --kubeconfig=$(kind get kubeconfig-path) get nodes
#
- ./mvnw >/dev/null
- docker rmi -f daggerok/webapp:v1 || echo 'oops...'
- docker build -t daggerok/webapp:v1 -f docker/Dockerfile webapp
# https://kind.sigs.k8s.io/docs/user/quick-start/#loading-an-image-into-your-cluster
- kind load docker-image daggerok/webapp:v1
- kubectl --kubeconfig=$(kind get kubeconfig-path) apply -f k8s/
- kubectl --kubeconfig=$(kind get kubeconfig-path) get pods --selector="app=webapp" --output=wide
- sleep 15s
- kubectl --kubeconfig=$(kind get kubeconfig-path) get all --output=wide
- kubectl --kubeconfig=$(kind get kubeconfig-path) get deployments webapp
- kubectl --kubeconfig=$(kind get kubeconfig-path) describe deployments webapp
##TODO: FIXME:
#- http :8080
#- http post :8080/maks
- kubectl --kubeconfig=$(kind get kubeconfig-path) delete -f k8s/
- kind delete cluster
# - stage: deploy
# jdk: openjdk8
# rvm: 2.6.4
# name: Gradle Reckon Tag Github and Jekyll GitHub Pages
# script: ./mvnw
# env:
# - secure: "rMVeoE0TGkC2ld/vt7yMtNmkb5ZuKCq4EWTlFDgKBZqRCaIZVZ+zJv1yHXf2mGEBt7j4tVn+fwlUm+8clA2vXUx4eRL+SBEz+MSS8fZRSgRLoGwvdhsH2Sbgx4logXBGd04rStRQgrh0Px/7SaLmtXGoSlmy8LQObZlfDg0hHKxa9dlPjhcjHYo3D4QmE00w9IAUp1cU2AtlUtxd+CsxBmBYHhRTRfQU1IZTseFGPflNjTRqpM5RM/IWe6ecdwKCdVZpqHH1VOmHtsbxxYBSYxt5QQtP5Pg2brUcJha5TCSs81dZ+SnleoEt1iIvW535UVCdLUKxPw56F2Q2ZEyjYWJcX5JRgfZ0Bxwwsg1Pj746utvzsgMntRNm0taWpQsGOSL7tAGQZgtB8TIP55I1QR/YmR0V7t1aYJ/4ooVgnaB5jyqmLQSCRbdbD9prZ+a4dmjTHyBBg4B7gAB/IP6IOyLFm6MOLmTJnVS7nofDTHTvpQ0+GoZuQqZLGc1AUPwbNTZIOO3PNKSUhoLtD00k9dBytWtTA0nzbbfKTa4auvavDkpQNEcoxZGRxnQsdZN4Rw6j/PAEd4Y67iMq8TPm2MCNXPpcOWNxO2ceh3JYl3tfiXqlIgAt9glLGd54RB60OBQa40Sy9oQFlSQIgLsRUjVI/tY/LUN8wHFgH34BvEM="
# before_deploy:
# - if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" != "master" ] ; then exit 0 ; fi
# - export GITHUB_AUTH="-Dorg.ajoberstar.grgit.auth.password=${GITHUB_PASSWORD} -Dorg.ajoberstar.grgit.auth.username=daggerok"
# - set -e
# - ./gradlew bundle
# - ./gradlew bundle-exec-just-the-docs-rake-search-init
# - ./gradlew bundle-exec-jekyll-build
# deploy:
# - provider: script
# skip_cleanup: true
# script: bash -c './gradlew ${GITHUB_AUTH} reckonTagPush -Preckon.stage=final'
# on:
# branch: master
# condition: "$TRAVIS_PULL_REQUEST == false"
# - provider: pages
# skip-cleanup: true
# github-token: "$GITHUB_TOKEN"
# keep-history: true
# local-dir: docs/_site
# target_branch: gh-pages
# on:
# branch: master
# condition: "$TRAVIS_PULL_REQUEST == false"
cache:
pip: true
packages: true
directories:
- ~/.docker
- ~/.kube
- ~/.m2