Skip to content

Commit 69c5e53

Browse files
committed
[WIP] goreleaser tooling
1 parent c3e2231 commit 69c5e53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+377
-584
lines changed

.goreleaser.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
before:
2+
hooks:
3+
- go version | grep --quiet "go1\.15\.2" || echo "Go binary version must be 1.15.2"
4+
- go mod download
5+
builds:
6+
- id: operator-sdk
7+
main: ./cmd/operator-sdk
8+
binary: operator-sdk
9+
env:
10+
- CGO_ENABLED=0
11+
- GO111MODULE=on
12+
- REPO=github.com/operator-framework/operator-sdk
13+
mod_timestamp: "{{ .CommitTimestamp }}"
14+
asmflags:
15+
- all=-trimpath={{ dir .ArtifactPath | dir | dir | dir }}
16+
gcflags:
17+
- all=-trimpath={{ dir .ArtifactPath | dir | dir | dir }}
18+
ldflags:
19+
- -X {{ .Env.REPO }}/internal/version.Version={{ if not .IsSnapshot }}v{{ end }}{{ .Version }}
20+
- -X {{ .Env.REPO }}/internal/version.GitVersion={{ .Tag }}
21+
- -X {{ .Env.REPO }}/internal/version.GitCommit={{ .FullCommit }}
22+
- -X {{ .Env.REPO }}/internal/version.KubernetesVersion={{ .Env.K8S_VERSION }}
23+
goarch:
24+
- amd64
25+
- arm64
26+
- ppc64le
27+
- s390x
28+
goos:
29+
- linux
30+
- darwin
31+
ignore:
32+
- goos: darwin
33+
goarch: arm64
34+
- goos: darwin
35+
goarch: ppc64le
36+
- goos: darwin
37+
goarch: s390x
38+
39+
# ansible-operator build steps
40+
- id: ansible-operator
41+
main: ./cmd/ansible-operator
42+
binary: ansible-operator
43+
env:
44+
- CGO_ENABLED=0
45+
- GO111MODULE=on
46+
- REPO=github.com/operator-framework/operator-sdk
47+
mod_timestamp: "{{ .CommitTimestamp }}"
48+
asmflags:
49+
- all=-trimpath={{ dir .ArtifactPath | dir | dir | dir }}
50+
gcflags:
51+
- all=-trimpath={{ dir .ArtifactPath | dir | dir | dir }}
52+
ldflags:
53+
- -X {{ .Env.REPO }}/internal/version.Version={{ if not .IsSnapshot }}v{{ end }}{{ .Version }}
54+
- -X {{ .Env.REPO }}/internal/version.GitVersion={{ .Tag }}
55+
- -X {{ .Env.REPO }}/internal/version.GitCommit={{ .FullCommit }}
56+
- -X {{ .Env.REPO }}/internal/version.KubernetesVersion={{ .Env.K8S_VERSION }}
57+
goarch:
58+
- amd64
59+
- arm64
60+
- ppc64le
61+
- s390x
62+
goos:
63+
- linux
64+
- darwin
65+
ignore:
66+
- goos: darwin
67+
goarch: arm64
68+
- goos: darwin
69+
goarch: ppc64le
70+
- goos: darwin
71+
goarch: s390x
72+
73+
# helm-operator build steps
74+
- id: helm-operator
75+
main: ./cmd/helm-operator
76+
binary: helm-operator
77+
env:
78+
- CGO_ENABLED=0
79+
- GO111MODULE=on
80+
- REPO=github.com/operator-framework/operator-sdk
81+
mod_timestamp: "{{ .CommitTimestamp }}"
82+
asmflags:
83+
- all=-trimpath={{ dir .ArtifactPath | dir | dir | dir }}
84+
gcflags:
85+
- all=-trimpath={{ dir .ArtifactPath | dir | dir | dir }}
86+
ldflags:
87+
- -X {{ .Env.REPO }}/internal/version.Version={{ if not .IsSnapshot }}v{{ end }}{{ .Version }}
88+
- -X {{ .Env.REPO }}/internal/version.GitVersion={{ .Tag }}
89+
- -X {{ .Env.REPO }}/internal/version.GitCommit={{ .FullCommit }}
90+
- -X {{ .Env.REPO }}/internal/version.KubernetesVersion={{ .Env.K8S_VERSION }}
91+
goarch:
92+
- amd64
93+
- arm64
94+
- ppc64le
95+
- s390x
96+
goos:
97+
- linux
98+
- darwin
99+
ignore:
100+
- goos: darwin
101+
goarch: arm64
102+
- goos: darwin
103+
goarch: ppc64le
104+
- goos: darwin
105+
goarch: s390x
106+
107+
# Use most recent tag and short commit for snapshot version.
108+
snapshot:
109+
name_template: "{{ .Tag }}"
110+
111+
# We don't use archives, so skip creating them.
112+
archives:
113+
- format: binary
114+
115+
checksum:
116+
name_template: 'checksums.txt'
117+
118+
# Sign checksum files with the local default PGP key.
119+
# TODO(estroz): configure CI PGP key
120+
# signs:
121+
# - signature: "${artifact}.asc"
122+
# cmd: gpg2
123+
# artifacts: checksum
124+
125+
# We use a custom changelog generator.
126+
changelog:
127+
128+
# TODO(estroz): configure homebrew publishing
129+
# brews:
130+
# - name: operator-sdk
131+
# ids:
132+
# - operator-sdk

.travis.yml

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
os: linux
2-
branches:
3-
except:
4-
- release-4.2
5-
- release-4.3
2+
dist: xenial
3+
4+
# Install python3 and utilities dependencies
5+
addons:
6+
apt:
7+
packages:
8+
- "python3"
9+
- "python3-pip"
610

711
language: go
12+
go:
13+
- 1.15.2
814
go_import_path: github.com/operator-framework/operator-sdk
915

10-
# go modules require xenial for mercurial TLS 1.2 support
11-
dist: xenial
12-
1316
# Python 3.6 is the default Python when language: python.
1417
# But when not language: python, Python 3 can not be used by default.
1518
# There is pip (/usr/bin/pip), but not pip3.
1619
# Because of it the global env is required.
1720
env:
1821
global:
19-
- PATH=/opt/python/3.6.7/bin:$PATH
22+
- PATH=/opt/python/3.6.7/bin:/tmp/operator-sdk/bin:$PATH
2023

2124
# Install python3 and utilities dependencies
2225
addons:
@@ -27,20 +30,20 @@ addons:
2730

2831
cache:
2932
directories:
30-
- $HOME/.cache/go-build
33+
- $(go env GOCACHE)
34+
- $(go env GOPATH)/pkg/mod
3135

32-
go:
33-
- 1.15.x
36+
branches:
37+
except:
38+
- release-4.2
39+
- release-4.3
3440

3541
# The `x_base_steps` top-level key is unknown to travis,
3642
# so we can use it to create a bunch of common build step
3743
# YAML anchors which we use in our build jobs.
3844
x_base_steps:
3945
# Base go, ansbile, and helm job
4046
- &test
41-
env:
42-
- CLUSTER=k8s
43-
# before_install for jobs that require go builds and do not run for doc-only changes
4447
before_install:
4548
# hack/ci/check-doc-only-update.sh needs to be sourced so
4649
# that it can properly exit the test early with success
@@ -51,10 +54,7 @@ x_base_steps:
5154
- make install
5255
- make setup-k8s
5356
- export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
54-
after_success:
55-
- echo "Tests passed"
5657
after_failure:
57-
- echo "Tests failed"
5858
- kubectl get all --all-namespaces
5959
- kubectl get events --all-namespaces --field-selector=type=Warning
6060
services:
@@ -66,10 +66,6 @@ x_base_steps:
6666
- travis_retry make tidy
6767
- git fetch origin --unshallow --tags
6868
install: make install
69-
after_success:
70-
- echo "Image build succeeded, and docker image tagged and pushed to repository"
71-
after_failure:
72-
- echo "Image build, docker image tagging, or docker image pushing to repository failed"
7369
services:
7470
- docker
7571

@@ -81,20 +77,18 @@ x_base_steps:
8177
# We need /etc/docker to be accessible to non-root users.
8278
# See https://github.com/moby/moby/pull/37847.
8379
- sudo chmod 0755 /etc/docker
84-
after_success:
85-
- echo "Manifest list push to registry succeeded"
86-
after_failure:
87-
- echo "Manifest list creation or push to registry failed"
8880
services:
8981
- docker
9082

9183
stages:
9284
- check
9385
- test
9486
- name: deploy
95-
if: type != pull_request AND ( tag IS present OR branch = master OR commit_message =~ /\[travis deploy\]/ )
87+
if: type != pull_request AND ( tag IS present OR branch = master OR branch =~ /^v[0-9]+\.[0-9]+\.x$/ OR commit_message =~ /\[travis deploy\]/ )
9688
- name: deploy-manifest-multiarch
97-
if: type != pull_request AND ( tag IS present OR branch = master OR commit_message =~ /\[travis deploy\]/ )
89+
if: type != pull_request AND ( tag IS present OR branch = master OR branch =~ /^v[0-9]+\.[0-9]+\.x$/ OR commit_message =~ /\[travis deploy\]/ )
90+
- name: release
91+
if: type != pull_request AND tag IS present
9892

9993
jobs:
10094
include:
@@ -103,23 +97,23 @@ jobs:
10397

10498
# Run the sanity tests
10599
- stage: check
106-
name: Sanity Tests
100+
name: sanity
107101
before_install:
108102
- git fetch origin --unshallow --tags
109103
script:
110104
- make test-sanity
111105

112106
# Run website checks
113-
- name: Doc Checks
107+
- name: doc links
114108
script:
115109
- make test-links
116110

117111
## Operator test stage jobs ##
118112

119113
# Build and test ansible and test ansible using molecule
120114
- stage: test
115+
name: ansible e2e
121116
<<: *test
122-
name: Ansible on Kubernetes
123117
before_script:
124118
- pip3 install --upgrade setuptools pip
125119
- pip install --user ansible~=2.9.13
@@ -128,15 +122,15 @@ jobs:
128122
- make test-e2e-ansible-molecule
129123

130124
# Test subcommands
131-
- <<: *test
132-
name: Subcommands and Integration on Kubernetes
125+
- name: subcommand and integration
126+
<<: *test
133127
script:
134128
- make test-subcommand
135129
- make test-integration
136130

137131
# Build and test go
138-
- <<: *test
139-
name: Go on Kubernetes
132+
- name: go unit and e2e
133+
<<: *test
140134
before_script:
141135
- (cd / && go get github.com/mattn/goveralls)
142136
script:
@@ -146,48 +140,55 @@ jobs:
146140
- $GOPATH/bin/goveralls -service=travis-ci -coverprofile=coverage.out -repotoken=$COVERALLS_TOKEN
147141

148142
# Build and test helm
149-
- <<: *test
150-
name: Helm on Kubernetes
143+
- name: helm e2e
144+
<<: *test
151145
script: make test-e2e-helm
152146

153147
## Image deploy/push stage jobs ##
154148

155149
# Build and deploy arm64 docker images
156150
- stage: deploy
157-
<<: *deploy
158-
name: Docker images for arm64
151+
name: build and push images (arm64)
159152
arch: arm64
153+
<<: *deploy
160154
script:
161-
- make image-build-ansible image-build-helm image-build-scorecard-test image-build-scorecard-test-kuttl image-build-sdk
162-
- make image-push-ansible image-push-helm image-push-scorecard-test image-push-scorecard-test-kuttl image-push-sdk
155+
- make -f images/Makefile image-build
156+
- make -f images/Makefile image-push
163157

164158
# Build and deploy amd64 docker images
165-
- <<: *deploy
166-
name: Docker images for amd64
159+
- name: build and push images (amd64)
167160
arch: amd64
161+
<<: *deploy
168162
script:
169-
- make image-build-ansible image-build-helm image-build-scorecard-test image-build-scorecard-test-kuttl image-build-sdk
170-
- make image-push-ansible image-push-helm image-push-scorecard-test image-push-scorecard-test-kuttl image-push-sdk
163+
- make -f images/Makefile image-build
164+
- make -f images/Makefile image-push
171165

172166
# Build and deploy ppc64le docker images
173-
- <<: *deploy
174-
name: Docker images for ppc64le
167+
- name: build and push images (ppc64le)
175168
arch: ppc64le
169+
<<: *deploy
176170
script:
177-
- make image-build-ansible image-build-helm image-build-scorecard-test image-build-scorecard-test-kuttl image-build-sdk
178-
- make image-push-ansible image-push-helm image-push-scorecard-test image-push-scorecard-test-kuttl image-push-sdk
171+
- make -f images/Makefile image-build
172+
- make -f images/Makefile image-push
179173

180174
# Build and deploy s390x docker images
181-
- <<: *deploy
182-
name: Docker images for s390x
175+
- name: build and push images (s390x)
183176
arch: s390x
177+
<<: *deploy
184178
script:
185-
- make image-build-ansible image-build-helm image-build-scorecard-test image-build-sdk
186-
- make image-push-ansible image-push-helm image-push-scorecard-test image-push-sdk
179+
# Use targets directly since
180+
- make -f images/Makefile image/ansible-operator image/helm-operator image/operator-sdk image/scorecard-test
181+
- make -f images/Makefile image-push/ansible-operator image-push/helm-operator image-push/operator-sdk image-push/scorecard-test
187182

188183
# Build and deploy ansible multi-arch manifest list
189184
- stage: deploy-manifest-multiarch
185+
name: push manifest lists
190186
<<: *manifest-deploy
191-
name: Manifest lists
192-
script:
193-
- make image-push-ansible-multiarch image-push-helm-multiarch image-push-scorecard-test-multiarch image-push-scorecard-test-kuttl-multiarch image-push-sdk-multiarch
187+
script: make -f images/Makefile image-push-multiarch
188+
189+
## Release jobs ##
190+
191+
- stage: release
192+
name: publish release
193+
before_install: git fetch origin --unshallow --tags
194+
script: make -f release/Makefile release TAG="$TRAVIS_TAG"

0 commit comments

Comments
 (0)