forked from operator-framework/operator-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
194 lines (169 loc) · 5.8 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
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
- git fetch origin --unshallow --tags
install:
- make install
- make setup-k8s
- export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
after_success:
- echo "Tests passed"
after_failure:
- echo "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
- git fetch origin --unshallow --tags
install: make install
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 fetch origin --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
before_install:
- git fetch origin --unshallow --tags
script:
- make test-sanity
# Run website checks
- name: Doc Checks
script:
- make test-links
## 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~=2.9.13
script:
- make test-e2e-ansible
- make test-e2e-ansible-molecule
# Test subcommands
- <<: *test
name: Subcommands and Integration on Kubernetes
script:
- make test-subcommand
- make test-integration
- make image-build-custom-scorecard-tests
# Build and test go
- <<: *test
name: Go on Kubernetes
before_script:
- (cd / && go get github.com/mattn/goveralls)
script:
- make test-unit
- make test-e2e-go
after_success:
- $GOPATH/bin/goveralls -service=travis-ci -coverprofile=coverage.out -repotoken=$COVERALLS_TOKEN
# Build and test helm
- <<: *test
name: Helm on Kubernetes
script: make test-e2e-helm
## Image deploy/push stage jobs ##
# Build and deploy arm64 docker images
- stage: deploy
<<: *deploy
name: Docker images for arm64
arch: arm64
script:
- make image-build-ansible image-build-helm image-build-scorecard-test image-build-scorecard-test-kuttl
- make image-push-ansible image-push-helm image-push-scorecard-test image-push-scorecard-test-kuttl
# Build and deploy amd64 docker images
- <<: *deploy
name: Docker images for amd64
arch: amd64
script:
- make image-build-ansible image-build-helm image-build-scorecard-test image-build-scorecard-test-kuttl
- make image-push-ansible image-push-helm image-push-scorecard-test image-push-scorecard-test-kuttl
# Build and deploy ppc64le docker images
- <<: *deploy
name: Docker images for ppc64le
arch: ppc64le
script:
- make image-build-ansible image-build-helm image-build-scorecard-test image-build-scorecard-test-kuttl
- make image-push-ansible image-push-helm image-push-scorecard-test image-push-scorecard-test-kuttl
# Build and deploy s390x docker images
- <<: *deploy
name: Docker images for s390x
arch: s390x
script:
- make image-build-ansible image-build-helm image-build-scorecard-test
- make image-push-ansible image-push-helm image-push-scorecard-test
# Build and deploy ansible multi-arch manifest list
- stage: deploy-manifest-multiarch
<<: *manifest-deploy
name: Manifest lists
script:
- make image-push-ansible-multiarch image-push-helm-multiarch image-push-scorecard-test-multiarch image-push-scorecard-test-kuttl-multiarch