forked from operator-framework/operator-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
267 lines (232 loc) · 7.71 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
os: linux
branches:
except:
- release-4.2
- release-4.3
language: go
go_import_path: github.com/operator-framework/operator-sdk
# go modules require xenial for mercurial TLS 1.2 support
dist: xenial
# Python 3.6 is the default Python when language: python.
# But when not language: python, Python 3 can not be used by default.
# There is pip (/usr/bin/pip), but not pip3.
# Because of it the global env is required.
env:
global:
- PATH=/opt/python/3.6.7/bin:$PATH
# Install python3 and utilities dependencies
addons:
apt:
packages:
- "python3"
- "python3-pip"
cache:
directories:
- $HOME/.cache/go-build
go:
- 1.13.x
# The `x_base_steps` top-level key is unknown to travis,
# so we can use it to create a bunch of common build step
# YAML anchors which we use in our build jobs.
x_base_steps:
# Base go, ansbile, and helm job
- &test
env:
- CLUSTER=k8s
# before_install for jobs that require go builds and do not run for doc-only changes
before_install:
# hack/ci/check-doc-only-update.sh needs to be sourced so
# that it can properly exit the test early with success
- source hack/ci/check-doc-only-update.sh
- travis_retry make tidy
install:
- make install
- make setup-k8s
- export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
after_success:
- echo "Build succeeded, operator was generated, memcached operator is running on $CLUSTER, and unit/integration tests pass"
after_failure:
- echo "Build failed, operator failed to generate, memcached operator is not running on $CLUSTER, or unit/integration tests failed"
- kubectl get all --all-namespaces
- kubectl get events --all-namespaces --field-selector=type=Warning
services:
- docker
# Base deploy job
- &deploy
before_install:
- travis_retry make tidy
install: make install
before_script:
- git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
- git fetch --unshallow --tags
after_success:
- echo "Image build succeeded, and docker image tagged and pushed to repository"
after_failure:
- echo "Image build, docker image tagging, or docker image pushing to repository failed"
services:
- docker
# Manifest list deploy job
- &manifest-deploy
before_script:
- git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
- git fetch --unshallow --tags
# TODO: remove the chmod command when docker-ce on travis is upgraded to 18.09.0+.
# We need /etc/docker to be accessible to non-root users.
# See https://github.com/moby/moby/pull/37847.
- sudo chmod 0755 /etc/docker
after_success:
- echo "Manifest list push to registry succeeded"
after_failure:
- echo "Manifest list creation or push to registry failed"
services:
- docker
stages:
- check
- test
- name: deploy
if: type != pull_request AND ( tag IS present OR branch = master OR commit_message =~ /\[travis deploy\]/ )
- name: deploy-manifest-multiarch
if: type != pull_request AND ( tag IS present OR branch = master OR commit_message =~ /\[travis deploy\]/ )
jobs:
include:
## Project check stage jobs ##
# Run the sanity tests
- stage: check
name: Sanity Tests
script:
- make test-sanity
# Run the markdown link checker
- name: Markdown Tests
script:
- make test-markdown
## Operator test stage jobs ##
# Build and test ansible and test ansible using molecule
- stage: test
<<: *test
name: Ansible on Kubernetes
before_script:
- pip3 install --upgrade setuptools pip
- pip install --user ansible
script:
- make test-e2e-ansible
- make test-e2e-ansible-molecule
# Test subcommands
- <<: *test
name: Subcommands on Kubernetes
script: make test-subcommand
# Build and test go
- <<: *test
name: Go on Kubernetes
before_install:
- (cd / && go get github.com/mattn/goveralls)
script:
- make test-unit
- $GOPATH/bin/goveralls -service=travis-ci -coverprofile=coverage.out -repotoken=$COVERALLS_TOKEN
- make test-e2e-go
- make test-integration
# Build and test helm
- <<: *test
name: Helm on Kubernetes
script: make test-e2e-helm
## Image deploy/push stage jobs ##
# Build and deploy arm64 ansible-operator docker image
- stage: deploy
<<: *deploy
name: Docker image for ansible-operator (arm64)
arch: arm64
script:
- make image-build-ansible
- make image-push-ansible
# Build and deploy amd64 ansible-operator docker image
- <<: *deploy
name: Docker image for ansible-operator (amd64)
arch: amd64
script:
- make image-build-ansible
- make image-push-ansible
# Build and deploy ppc64le ansible-operator docker image
- <<: *deploy
name: Docker image for ansible-operator (ppc64le)
arch: ppc64le
script:
- make image-build-ansible
- make image-push-ansible
# Build and deploy s390x ansible-operator docker image
- <<: *deploy
name: Docker image for ansible-operator (s390x)
arch: s390x
script:
- make image-build-ansible
- make image-push-ansible
# Build and deploy arm64 helm-operator docker image
- <<: *deploy
name: Docker image for helm-operator (arm64)
arch: arm64
script:
- make image-build-helm
- make image-push-helm
# Build and deploy amd64 helm-operator docker image
- <<: *deploy
name: Docker image for helm-operator (amd64)
arch: amd64
script:
- make image-build-helm
- make image-push-helm
# Build and deploy ppc64le helm-operator docker image
- <<: *deploy
name: Docker image for helm-operator (ppc64le)
arch: ppc64le
script:
- make image-build-helm
- make image-push-helm
# Build and deploy s390x helm-operator docker image
- <<: *deploy
name: Docker image for helm-operator (s390x)
arch: s390x
script:
- make image-build-helm
- make image-push-helm
# Build and deploy arm64 scorecard-proxy docker image
- <<: *deploy
name: Docker image for scorecard-proxy (arm64)
arch: arm64
script:
- make image-build-scorecard-proxy
- make image-push-scorecard-proxy
# Build and deploy amd64 scorecard-proxy docker image
- <<: *deploy
name: Docker image for scorecard-proxy (amd64)
arch: amd64
script:
- make image-build-scorecard-proxy
- make image-push-scorecard-proxy
# Build and deploy ppc64le scorecard-proxy docker image
- <<: *deploy
name: Docker image for scorecard-proxy (ppc64le)
arch: ppc64le
script:
- make image-build-scorecard-proxy
- make image-push-scorecard-proxy
# Build and deploy s390x scorecard-proxy docker image
- <<: *deploy
name: Docker image for scorecard-proxy (s390x)
arch: s390x
script:
- make image-build-scorecard-proxy
- make image-push-scorecard-proxy
# Build and deploy ansible multi-arch manifest list
- stage: deploy-manifest-multiarch
<<: *manifest-deploy
name: Manifest list for ansible-operator
script:
- make image-push-ansible-multiarch
# Build and deploy helm multi-arch manifest list
- <<: *manifest-deploy
name: Manifest list for helm-operator
script:
- make image-push-helm-multiarch
# Build and deploy scorecard-proxy multi-arch manifest list
- <<: *manifest-deploy
name: Manifest list for scorecard-proxy
script:
- make image-push-scorecard-proxy-multiarch