forked from vmware-archive/kubeless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
174 lines (165 loc) · 10.5 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
167
168
169
170
171
172
173
174
sudo: required
dist: trusty
group: deprecated-2017Q4
language: go
os:
- linux
go:
- 1.8.3
go_import_path: github.com/kubeless/kubeless
services:
- docker
env:
matrix:
- TEST_TARGET=unit
- TEST_TARGET=minikube
- TEST_TARGET=minikube_kafka
- TEST_TARGET=GKE
global:
- CONTROLLER_IMAGE_NAME=bitnami/kubeless-controller
- CONTROLLER_TAG=${TRAVIS_TAG:-build-$TRAVIS_BUILD_ID}
- CONTROLLER_IMAGE=${CONTROLLER_IMAGE_NAME}:${CONTROLLER_TAG}
- CGO_ENABLED=0
- TEST_DEBUG=1
- GKE_VERSION=1.7.11-gke.1
- secure: QTXmAe9Z5WkWq8KDvcP5JauyYrYaupywLUQjlE2SJWuD1wvgcQxPlkWF5NpSAL70TqnGhkmCmsfQBdJ+T59/yYjTldfnFumkp1dABdIURFPQc8h7IeF+evSSmwgaGwTc7bRPu9cprH1yflwyAEQmnzKGkT91ZHszZxfyMDFKPcFJhBdz2lcOsJRIetgrMOBS0sguZVnnY08okq6F0DEDk3SYT9RoPN0/NjyerPpxJ7arS2bN02R6ogBZM7LiTUF6aFuA3vaVKZarVBXYL5ZDr0HvHcSuT0T8F+CGD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3K8ehAUTPF4DlNiEWGlfMhqofciSDEsSUXKz39ndZng7RXIJU9u8PGFhGSHwoZOPvVTTABT8Fa+i+omgdUsQkJOAghw1AZUD+W0Tp88J/PEZcWLd0WuslKPAioUEsNqftPT7kWVc+4BoGnZ2ZejlKsNwYnGNPCIVoE7eMa1MQM6UqsMfTzln8dQO8Ab0qVNEcm5tkwDlYoEl4kF6smV/GpnUJvMnXJycTnCr9XB7/t4Hxr1GJlQm6dumsweXTFoZTXDZtCsRtXbaFrFg+pqRRs+9BqOIDFXO1PFLrf1eryaztiErysdr66LR4/9pS1IZ8I2wJGh3bXEWDSY4clc0syusuXOKSlNDHQsWbPMC2IDNygQr/DigQmtYrwLpdiiUsF1XPHMyQKGmop6ewTYzd7DrJWwDGPrkW2YIJQgvxpkX58/dKNp4BZQY5wuXKQLvUQjFOa3gelfsbFFuhQEEbcIfINBI9TuM5K0Q+HXPdlfef/0Cbp6pktIEUYErK46mf2iy+1phXDZ0UPz/ZXe2NmawEPQVMBJaCIkr/B75mn5p7oGSKdJ3NpN87Bbn+Pwpx3tKpuDpc9hOjlfAGo+dcU6BAYkcwUSBGInjUsRNf4=
before_install:
- set -e
# Decide if we should run the tests
- |
case $TEST_TARGET in
# We will always build assets when doing unit tests or minikube end-2-end tests
unit|minikube)
export SHOULD_TEST=1
;;
# In case of GKE we will only want to build if it is
# a build of a branch in the kubeless/kubeless repository
GKE)
if [[ -n "$GKE_ADMIN" && "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
export SHOULD_TEST=1
export SHOULD_INSTALL_GCLOUD=1
fi
;;
# In kase of minikube+kafka we want to test it if
# it is a Pull Request related to Kafka (discovered from the PR title)
# or if the build is from the "master" branch
minikube_kafka)
if [[ "$TRAVIS_PULL_REQUEST" != false ]]; then
pr_kafka_title=$(curl -H "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/${TRAVIS_PULL_REQUEST}" | grep title | grep -i kafka || true)
fi
if [[ "$TRAVIS_PULL_REQUEST" == false || "$pr_kafka_title" != "" ]]; then
export SHOULD_TEST=1
fi
;;
esac
install:
- |
if [[ "$SHOULD_TEST" == "1" ]]; then
make bootstrap
fi
if [[ "$SHOULD_INSTALL_GCLOUD" == "1" ]]; then
export GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/client_secrets.json
openssl aes-256-cbc -K $encrypted_1dbafa65b3ad_key -iv $encrypted_1dbafa65b3ad_iv -in .github/gcloud.json.enc -out $GOOGLE_APPLICATION_CREDENTIALS -d
if [ ! -d $HOME/gcloud/google-cloud-sdk ]; then
mkdir -p $HOME/gcloud &&
wget -q https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz --directory-prefix=$HOME/gcloud &&
cd $HOME/gcloud &&
tar xzf google-cloud-sdk.tar.gz &&
printf '\ny\n\ny\ny\n' | ./google-cloud-sdk/install.sh &&
cd $TRAVIS_BUILD_DIR;
fi
gcloud -q config set project $GKE_PROJECT
if [ -a $GOOGLE_APPLICATION_CREDENTIALS ]; then
gcloud -q auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS;
fi
echo "Starting GKE cluster"
./script/start-gke-env.sh $GKE_CLUSTER $ZONE $GKE_VERSION $GKE_ADMIN > $TRAVIS_BUILD_DIR/gke-start.log 2>&1 &
GKE_START_PID=$!
fi
script:
- |
if [[ "$SHOULD_TEST" == "1" ]]; then
make VERSION=${TRAVIS_TAG:-build-$TRAVIS_BUILD_ID} binary
make controller-image CONTROLLER_IMAGE=$CONTROLLER_IMAGE
make all-yaml
sed -i.bak 's/'":latest"'/'":${CONTROLLER_TAG}"'/g' kubeless.yaml
sed -i.bak 's/'":latest"'/'":${CONTROLLER_TAG}"'/g' kubeless-rbac.yaml
sed -i.bak 's/'":latest"'/'":${CONTROLLER_TAG}"'/g' kubeless-openshift.yaml
case $TEST_TARGET in
unit)
make test
make validation
;;
minikube)
./script/integration-tests minikube deployment
./script/integration-tests minikube basic
;;
minikube_kafka)
./script/integration-tests minikube deployment
./script/integration-tests minikube kafka
;;
GKE)
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker push $CONTROLLER_IMAGE
echo "Waiting for the GKE cluster to be ready"
tail -f $TRAVIS_BUILD_DIR/gke-start.log &
wait $GKE_START_PID
if ! kubectl get pods -n kubeless 2>&1 | grep -q "No resources found"; then
echo "Waiting for a previous installation to be cleaned"
bash -c 'grep -q "No resources found" <(timeout 60 kubectl get pods -n kubeless -w 2>&1)'
fi
./script/integration-tests gke_${GKE_PROJECT}_${ZONE}_${GKE_CLUSTER}
;;
esac
else
echo "Skipping tests"
fi
after_success:
- |
if [[ "$TRAVIS_BRANCH" == master && \
"$TRAVIS_PULL_REQUEST" == false ]]; then
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker tag $CONTROLLER_IMAGE ${CONTROLLER_IMAGE_NAME}:latest
docker push ${CONTROLLER_IMAGE_NAME}:latest
fi
before_deploy:
- |
if [[ "$SHOULD_TEST" != "1" ]]; then
echo "Unable to release a job that has not been tested!"
return 1
fi
- |
if [ "$TEST_TARGET" = minikube ]; then
make VERSION=${TRAVIS_TAG:-build-$TRAVIS_BUILD_ID} binary-cross
for d in bundles/kubeless_*; do zip -r9 $d.zip $d/; done
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker tag $CONTROLLER_IMAGE ${CONTROLLER_IMAGE_NAME}:latest
docker push $CONTROLLER_IMAGE
NEW_DIGEST=$(./script/find_digest.sh ${CONTROLLER_IMAGE_NAME} ${TRAVIS_TAG} | cut -d " " -f 2)
sed 's/'":${CONTROLLER_TAG}"'/'"@$NEW_DIGEST"'/g' kubeless.yaml > kubeless-${TRAVIS_TAG}.yaml
sed 's/'":${CONTROLLER_TAG}"'/'"@$NEW_DIGEST"'/g' kubeless-rbac.yaml > kubeless-rbac-${TRAVIS_TAG}.yaml
sed 's/'":${CONTROLLER_TAG}"'/'"@$NEW_DIGEST"'/g' kubeless-openshift.yaml > kubeless-openshift-${TRAVIS_TAG}.yaml
fi
deploy:
provider: releases
api_key:
secure: rOXYYMxdFrP7mtExHLK+IOwW7LmV8Y7pJjiOx023F/z0HeyJLcFDY4Mvr6n+nIjf8idPnINARYiHH0eBTDAKNsBhpod+QPexO3gy8bWAbZS6c1wQtV6EuKKfDhvsLQdylh+9pBrtC71GMxBzGWKzcs2dxHZULNrjDxqA99JMWpkzJRVcaU0D9c68aUVIXdI90NTEWG+yuAUw+qWaHIDGNDylS3/5DXs+PNV75ExuL3dWxXJQlEK7+l60/0rMNm+VZIX/5T3YE/cfdXoD2wl82umjzNzoBk2emo2MfHtCyxf+XYBEDZeRHZHZSOg3HCOcRmbKKzOLNkvaSMlyT4celiZoOrR1vASbxzJOBcW+QkCoJ5QAxXwZD7KJk0V89AOv6YR2skMbG7a7+tzkeZ8VHZny7VMgrTBi6bYxZDV1+v28Xm0R/GWnot2W/Nk92mHyVyh3XifMrOHTgXb6G6iIpCypj0i6Ktr9p8uZEhUTqcpljAcRQdnMNHaWWPttM5T3IW94iROdymPwo65FJukHQv/h3GjYB0P1jagBZfbcYQNX/wEjZ3tIVknYfXfRlZXTQjj29DAynGTbw8q07iRR2eNiDUQAS54JQnXOewUtmVRo9maIjxUs4XEE3/IsRNXpwMKGCOP+fjHeL8XtDwrRzmw8nS0LcnooKpMCaOYD4hA=
file_glob: true
file:
- kubeless-${TRAVIS_TAG}.yaml
- kubeless-rbac-${TRAVIS_TAG}.yaml
- kubeless-openshift-${TRAVIS_TAG}.yaml
- bundles/kubeless_*.zip
skip_cleanup: true
overwrite: true
on:
tags: true
repo: kubeless/kubeless
condition: $CGO_ENABLED = 0
after_deploy:
- ./script/upload_release_notes.sh ${TRAVIS_TAG}