forked from linkerd/linkerd2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
178 lines (156 loc) · 5.45 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
175
176
177
178
---
dist: trusty
sudo: false
# We do not test pushes to branches, since they are redundant with the pull_request build
# for each branch. Take that, Big CI!
branches:
only:
- master
- /^(edge|stable)-\d+\.\d+\.[\w-]+$/ # build version tags
stages:
- name: test
- name: docker-deploy
if: type != pull_request
- name: integration-test
if: type != pull_request
jobs:
include:
- language: go
# Quote the version number to avoid parsing issues like
# https://github.com/travis-ci/gimme/issues/132.
go: "1.11.5"
go_import_path: github.com/linkerd/linkerd2
cache:
directories:
- target
- vendor
- "$HOME/.cache"
before_install:
- echo $GITCOOKIE_SH | base64 -d | bash
install:
- ./bin/dep ensure -vendor-only -v
- ./bin/dep status -v
script:
# TODO decide whether protoc should be committed or not. If so, we shouldn't do
# this or we should error if it dirties the repo.
- ./bin/protoc-go.sh
- go test -cover -race -v ./...
- ./bin/lint --verbose
- language: node_js
node_js:
- "10"
cache: yarn
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.7.0
- export PATH="$HOME/.yarn/bin:$PATH"
- export NODE_ENV=test
install:
- ./bin/web
script:
- ./bin/web test --reporters=jest-dot-reporter
- language: generic
script:
- |
(
. bin/_tag.sh
for f in $( grep -lR --include=Dockerfile\* go-deps: . ) ; do
validate_go_deps_tag $f
done
)
# Push container images to Google Container Registry.
- stage: docker-deploy
language: generic
services:
- docker
cache:
directories:
- "$HOME/google-cloud-sdk/"
- "$HOME/.cache"
before_install:
- docker version
- |
# Install gcloud and kubectl.
dir="${CLOUDSDK_INSTALL_DIR:-${HOME}}/google-cloud-sdk"
(. bin/_gcp.sh ; install_gcloud_kubectl "$dir")
. "$dir/path.bash.inc"
- |
# Configure gcloud with a service account.
openssl aes-256-cbc -K $encrypted_ea955175587c_key -iv $encrypted_ea955175587c_iv -in .gcp.json.enc -out .gcp.json -d
(. bin/_gcp.sh ; set_gcloud_config "$GCP_PROJECT" "$GCP_ZONE" "$GKE_CLUSTER")
- |
# Get a kubernetes context.
(. bin/_gcp.sh ; get_k8s_ctx "$GCP_PROJECT" "$GCP_ZONE" "$GKE_CLUSTER")
- gcloud version
- kubectl version --short
before_script:
- gcloud docker --authorize-only
- bin/docker-pull-deps
# Pulling master helps with docker build cache, but may fail if we're
# adding a new image to the mix.
- bin/docker-pull master || echo "docker pull failed" >&2
- |
export LINKERD_TAG=$(. bin/_tag.sh ; clean_head_root_tag)
echo "LINKERD_TAG=${LINKERD_TAG}"
- export BUILD_DEBUG=1 DOCKER_TRACE=1
script:
- bin/docker-build
after_success:
- bin/docker-push-deps
- bin/docker-push $LINKERD_TAG
- bin/docker-retag-all $LINKERD_TAG master && bin/docker-push master
- target/cli/linux/linkerd install --control-plane-version=$LINKERD_TAG |tee linkerd.yml
- kubectl -n linkerd apply -f linkerd.yml --prune --selector='linkerd.io/control-plane-component'
# Run integration tests after container images have been published.
- stage: integration-test
language: go
go: "1.11.5"
go_import_path: github.com/linkerd/linkerd2
services:
- docker
cache:
directories:
- vendor
- "$HOME/google-cloud-sdk/"
- "$HOME/.cache"
before_install:
- echo $GITCOOKIE_SH | base64 -d | bash
install:
- ./bin/dep ensure -vendor-only -v
- ./bin/dep status -v
- |
# Install gcloud and kubectl.
dir="${CLOUDSDK_INSTALL_DIR:-${HOME}}/google-cloud-sdk"
(. bin/_gcp.sh ; install_gcloud_kubectl "$dir")
. "$dir/path.bash.inc"
- |
# Configure gcloud with a service account.
openssl aes-256-cbc -K $encrypted_ea955175587c_key -iv $encrypted_ea955175587c_iv -in .gcp.json.enc -out .gcp.json -d
(. bin/_gcp.sh ; set_gcloud_config "$GCP_PROJECT" "$GCP_ZONE" "$GKE_CLUSTER")
- |
# Get a kubernetes context.
(. bin/_gcp.sh ; get_k8s_ctx "$GCP_PROJECT" "$GCP_ZONE" "$GKE_CLUSTER")
- |
# Install linkerd cli.
version="$(CI_FORCE_CLEAN=1 bin/root-tag)"
image="gcr.io/linkerd-io/cli-bin:$version"
id=$(docker create $image)
docker cp "$id:/out/linkerd-linux" "./linkerd"
- gcloud version
- kubectl version --short
- ./linkerd version --client
script:
- |
# Run integration tests.
version="$(./linkerd version --client --short | tr -cd '[:alnum:]-')"
./bin/test-cleanup
./bin/test-run `pwd`/linkerd linkerd-$version
- |
# Run linkerd-cni integration tests.
TAG="$(./linkerd version --client --short)" go test -cover -race -v ./cni-plugin/test -integration-tests
after_script:
- |
# Cleanup after integration test run.
./bin/test-cleanup
notifications:
email:
on_success: never