forked from operator-framework/operator-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
174 lines (153 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
167
168
169
170
171
172
173
branches:
except:
- release-4.2
- release-4.3
language: go
go_import_path: github.com/operator-framework/operator-sdk
sudo: required
# 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:
# before_install for jobs that require go builds and do not run for doc-only changes
- &go_before_install
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
# Base go, ansbile, and helm job
- &test
stage: test
env:
- CLUSTER=k8s
os: linux
<<: *go_before_install
install:
- make install
- hack/ci/setup-${CLUSTER}.sh
- 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
stage: deploy
if: type != pull_request AND ( tag IS present OR branch = master OR commit_message =~ /\[travis deploy\]/ )
<<: *go_before_install
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
stage: "Deploy multi-arch manifest lists"
if: type != pull_request AND ( tag IS present OR branch = master OR commit_message =~ /\[travis 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
jobs:
include:
# Build and test go
- <<: *test
name: Go on Kubernetes
script: make test-e2e-go
# Build and test ansible and test ansible using molecule
- <<: *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
# Build and test helm
- <<: *test
name: Helm on Kubernetes
script: make test-e2e-helm
# Test subcommands
- <<: *test
name: Subcommands on Kubernetes
script: make test-subcommand
# Run the unit, sanity, markdown, coverage and linter tests
- stage: test
name: Unit, Sanity, and Markdown Tests
before_install:
- go get github.com/mattn/goveralls
script:
- make test-sanity test-unit test-markdown test-linter
- $GOPATH/bin/goveralls -service=travis-ci -coverprofile=coverage.out -repotoken=$COVERALLS_TOKEN
after_success: echo 'Tests Passed'
after_failure: echo 'Failure in unit, sanity, markdown, coverage or linter test'
# Build and deploy ansible-operator docker image
- <<: *deploy
name: Docker image for ansible-operator
script:
- make image-build-ansible
- make image-push-ansible
# Build and deploy amd64 helm-operator docker image
- <<: *deploy
name: Docker image for helm-operator (amd64)
os: linux
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)
os: linux-ppc64le
script:
- make image-build-helm
- make image-push-helm
# Build and deploy scorecard-proxy docker image
- <<: *deploy
name: Docker image for scorecard-proxy
script:
- make image-build-scorecard-proxy
- make image-push-scorecard-proxy
# Build and deploy helm multi-arch manifest list
- <<: *manifest-deploy
name: Manifest list for helm-operator
script:
- make image-push-helm-multiarch