Skip to content

Commit eb8f5ce

Browse files
committed
automate prerelease commit, clean up release guide
1 parent 25c56b2 commit eb8f5ce

File tree

13 files changed

+1433
-374
lines changed

13 files changed

+1433
-374
lines changed

.goreleaser.yml

Lines changed: 23 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
env:
33
- CGO_ENABLED=0
44
- GO111MODULE=on
5+
- GOPROXY=https://proxy.golang.org|direct
56
- REPO=github.com/operator-framework/operator-sdk
67

78
# Hooks to run before any build is run.
@@ -22,25 +23,16 @@ builds:
2223
gcflags:
2324
- all=-trimpath={{ .Env.PWD }}
2425
ldflags:
25-
- -X {{ .Env.REPO }}/internal/version.Version={{ if not .IsSnapshot }}v{{ end }}{{ .Version }}
26-
- -X {{ .Env.REPO }}/internal/version.GitVersion={{ .Tag }}
27-
- -X {{ .Env.REPO }}/internal/version.GitCommit={{ .FullCommit }}
26+
- -X {{ .Env.REPO }}/internal/version.Version={{ .Env.SIMPLE_VERSION }}
27+
- -X {{ .Env.REPO }}/internal/version.GitVersion={{ .Env.GIT_VERSION }}
28+
- -X {{ .Env.REPO }}/internal/version.GitCommit={{ .Env.GIT_COMMIT }}
2829
- -X {{ .Env.REPO }}/internal/version.KubernetesVersion={{ .Env.K8S_VERSION }}
29-
goarch:
30-
- amd64
31-
- arm64
32-
- ppc64le
33-
- s390x
34-
goos:
35-
- linux
36-
- darwin
37-
ignore:
38-
- goos: darwin
39-
goarch: arm64
40-
- goos: darwin
41-
goarch: ppc64le
42-
- goos: darwin
43-
goarch: s390x
30+
targets: &build-targets
31+
- darwin_amd64
32+
- linux_amd64
33+
- linux_arm64
34+
- linux_ppc64le
35+
- linux_s390x
4436

4537
# ansible-operator build steps
4638
- id: ansible-operator
@@ -52,25 +44,11 @@ builds:
5244
gcflags:
5345
- all=-trimpath={{ .Env.PWD }}
5446
ldflags:
55-
- -X {{ .Env.REPO }}/internal/version.Version={{ if not .IsSnapshot }}v{{ end }}{{ .Version }}
56-
- -X {{ .Env.REPO }}/internal/version.GitVersion={{ .Tag }}
57-
- -X {{ .Env.REPO }}/internal/version.GitCommit={{ .FullCommit }}
47+
- -X {{ .Env.REPO }}/internal/version.Version={{ .Env.SIMPLE_VERSION }}
48+
- -X {{ .Env.REPO }}/internal/version.GitVersion={{ .Env.GIT_VERSION }}
49+
- -X {{ .Env.REPO }}/internal/version.GitCommit={{ .Env.GIT_COMMIT }}
5850
- -X {{ .Env.REPO }}/internal/version.KubernetesVersion={{ .Env.K8S_VERSION }}
59-
goarch:
60-
- amd64
61-
- arm64
62-
- ppc64le
63-
- s390x
64-
goos:
65-
- linux
66-
- darwin
67-
ignore:
68-
- goos: darwin
69-
goarch: arm64
70-
- goos: darwin
71-
goarch: ppc64le
72-
- goos: darwin
73-
goarch: s390x
51+
targets: *build-targets
7452

7553
# helm-operator build steps
7654
- id: helm-operator
@@ -82,29 +60,15 @@ builds:
8260
gcflags:
8361
- all=-trimpath={{ .Env.PWD }}
8462
ldflags:
85-
- -X {{ .Env.REPO }}/internal/version.Version={{ if not .IsSnapshot }}v{{ end }}{{ .Version }}
86-
- -X {{ .Env.REPO }}/internal/version.GitVersion={{ .Tag }}
87-
- -X {{ .Env.REPO }}/internal/version.GitCommit={{ .FullCommit }}
63+
- -X {{ .Env.REPO }}/internal/version.Version={{ .Env.SIMPLE_VERSION }}
64+
- -X {{ .Env.REPO }}/internal/version.GitVersion={{ .Env.GIT_VERSION }}
65+
- -X {{ .Env.REPO }}/internal/version.GitCommit={{ .Env.GIT_COMMIT }}
8866
- -X {{ .Env.REPO }}/internal/version.KubernetesVersion={{ .Env.K8S_VERSION }}
89-
goarch:
90-
- amd64
91-
- arm64
92-
- ppc64le
93-
- s390x
94-
goos:
95-
- linux
96-
- darwin
97-
ignore:
98-
- goos: darwin
99-
goarch: arm64
100-
- goos: darwin
101-
goarch: ppc64le
102-
- goos: darwin
103-
goarch: s390x
67+
targets: *build-targets
10468

10569
# Use most recent tag and short commit for snapshot version.
10670
snapshot:
107-
name_template: "{{ .Tag }}"
71+
name_template: "{{ .Env.GIT_VERSION }}"
10872

10973
# We don't use archives, so skip creating them.
11074
archives:
@@ -116,10 +80,10 @@ checksum:
11680

11781
# Sign checksum files with the local default PGP key.
11882
# TODO(estroz): configure CI PGP key
119-
# signs:
120-
# - signature: "${artifact}.asc"
121-
# cmd: gpg2
122-
# artifacts: checksum
83+
signs:
84+
- signature: "${artifact}.asc"
85+
cmd: gpg2
86+
artifacts: checksum
12387

12488
# We use a custom changelog generator.
12589
changelog:

CHANGELOG.md

Lines changed: 1083 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ export GIT_COMMIT = $(shell git rev-parse HEAD)
77
export K8S_VERSION = 1.18.8
88

99
# Build settings
10+
export TOOLS_DIR = tools/bin
11+
export SCRIPTS_DIR = tools/scripts
1012
REPO = $(shell go list -m)
1113
BUILD_DIR = build
12-
TOOLS_DIR = tools/bin
13-
SCRIPTS_DIR = tools/scripts
1414
GO_ASMFLAGS = -asmflags "all=-trimpath=$(shell dirname $(PWD))"
1515
GO_GCFLAGS = -gcflags "all=-trimpath=$(shell dirname $(PWD))"
1616
GO_BUILD_ARGS = \
@@ -150,9 +150,12 @@ test-e2e-integration:: ## Run integration tests
150150
./hack/tests/subcommand-olm-install.sh
151151

152152
.PHONY: release
153-
release: ## Release the Operator SDK
154-
@rm -rf dist/
155-
$(MAKE) -f release/Makefile GO_BUILD_ARGS='$(GO_BUILD_ARGS)'
153+
release: ## Release the operator-sdk project
154+
$(MAKE) -f release/Makefile release
155+
156+
.PHONY: prerelease
157+
prerelease: ## Pre-release changes to commit prior to releasing the operator-sdk project
158+
$(MAKE) -f release/Makefile prerelease
156159

157160
.DEFAULT_GOAL := help
158161
.PHONY: help

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,39 @@ operators easier by providing:
2828
- Tools for scaffolding and code generation to bootstrap a new project fast
2929
- Extensions to cover common operator use cases
3030

31+
## Dependency and platform support
32+
33+
### Go version
34+
35+
Release binaries will be built with the Go compiler version specified in the Operator SDK's [prerequisites section][doc-readme-prereqs].
36+
37+
### Kubernetes versions
38+
39+
As the Operator SDK interacts directly with the Kubernetes API, certain API features are assumed to exist in the target cluster.
40+
The currently supported Kubernetes version will always be listed in the SDK [prerequisites section][doc-readme-prereqs].
41+
42+
### Platforms
43+
44+
The following matrix defines which architectures are supported for GNU Linux:
45+
46+
| | `amd64` | `arm64` | `ppc64le` | `s390x` |
47+
|-------------------------------|-----------------|-----------------|-----------------|-----------------|
48+
| `operator-sdk` |||||
49+
| `ansible-operator` |||||
50+
| `helm-operator` |||||
51+
| `scorecard-test` image |||||
52+
| `scorecard-test-kuttl` image |||| - |
53+
54+
The following matrix defines which architectures are supported for MacOS Darwin:
55+
56+
| | `amd64` |
57+
|-------------------------------|-----------------|
58+
| `operator-sdk` ||
59+
| `ansible-operator` ||
60+
| `helm-operator` ||
61+
62+
Support for the Windows platform is not on the roadmap at this time.
63+
3164
## License
3265

3366
Operator SDK is under Apache 2.0 license. See the [LICENSE][license_file] file for details.

netlify.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
[build]
66
publish = "public"
77
base = "website"
8-
command = "cd themes/docsy && git submodule update -f --init && cd ../.. && npm install postcss-cli autoprefixer@^9.0.0 && hugo version && hugo"
8+
command = """
9+
git submodule update -f --init themes/docsy && \
10+
npm install postcss-cli autoprefixer@^9.0.0 && \
11+
./set_version.sh && \
12+
hugo version && \
13+
hugo
14+
"""
915

1016
# "production" environment specific build settings
1117
[build.environment]

release.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
if [[ $# != 1 ]]; then
6+
echo "usage: $0 vX.Y.Z"
7+
exit 1
8+
fi
9+
10+
VER=$1
11+
12+
NUMRE="0|[1-9][0-9]*"
13+
PRERE="\-(alpha|beta|rc)\.[1-9][0-9]*"
14+
15+
if ! [[ "$VER" =~ ^v($NUMRE)\.($NUMRE)\.($NUMRE)($PRERE)?$ ]]; then
16+
echo "malformed version: \"$VER\""
17+
exit 1
18+
fi
19+
20+
if git ls-files --others --exclude-standard | grep -Ev 'build/operator-sdk-v.+'; then
21+
echo "directory has untracked files"
22+
exit 1
23+
fi
24+
25+
if ! git diff-index --quiet HEAD --; then
26+
echo "directory has uncommitted files"
27+
exit 1
28+
fi
29+
30+
GO_VER="1.15"
31+
if ! go version | cut -d" " -f3 | grep -q "$GO_VER"; then
32+
echo "must compile binaries with Go compiler version v${GO_VER}"
33+
exit 1
34+
fi
35+
36+
# Detect whether versions in code were updated.
37+
VER_FILE="internal/version/version.go"
38+
CURR_VER="$(sed -nr 's|\s+Version\s+= "(.+)"|\1|p' "$VER_FILE" | tr -d ' \t\n')"
39+
if [[ "$VER" != "$CURR_VER" ]]; then
40+
echo "version is not set correctly in $VER_FILE"
41+
exit 1
42+
fi
43+
44+
INSTALL_GUIDE_FILE="website/content/en/docs/installation/install-operator-sdk.md"
45+
CURR_VER_INSTALL_GUIDE_FILE="$(sed -nr 's/.*RELEASE_VERSION=(.+)/\1/p' "$INSTALL_GUIDE_FILE" | tr -d ' \t\n')"
46+
if [[ "$VER" != "$CURR_VER_INSTALL_GUIDE_FILE" ]]; then
47+
echo "version '$VER' is not set correctly in $INSTALL_GUIDE_FILE"
48+
exit 1
49+
fi
50+
51+
# Tag the release commit and verify its tag.
52+
git tag --sign --message "Operator SDK $VER" "$VER"
53+
git verify-tag --verbose "$VER"
54+
55+
# Run the release builds.
56+
make release
57+
58+
# Verify the signatures
59+
for f in $(ls dist/*.asc); do gpg --verify $f; done

release/Makefile

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
## This Makefile should only be called from the project root ##
1+
## This Makefile should only be called from the project root Makefile ##
22

33
# Needed for glob expansion.
4-
SHELL = /bin/bash
4+
SHELL ?= /bin/bash
55
.SHELLFLAGS = -O extglob -c
66

77
# Repo prefix for image tags.
@@ -10,21 +10,17 @@ IMAGE_REPO ?= quay.io/operator-framework
1010
# Dry run flags.
1111
ifneq ($(DRY_RUN),)
1212
SNAPSHOT_FLAGS = --snapshot --skip-publish --rm-dist
13-
TAG ?= $(GIT_VERSION)
1413
endif
1514

1615
# Ensure that this Makefile is run from the project root (always contains the 'cmd/' directory).
1716
ifeq (,$(wildcard cmd))
1817
$(error "This Makefile must be invoked from the operator-sdk project root")
1918
endif
2019

21-
.PHONY: all
22-
all: release
23-
24-
.PHONY: check_tag
25-
check_tag:
26-
ifeq (,$(TAG))
27-
$(error "TAG must be set to a release tag")
20+
.PHONY: check_git_version
21+
check_git_version:
22+
ifeq (,$(GIT_VERSION))
23+
$(error "GIT_VERSION must be set to a release tag")
2824
endif
2925

3026
.PHONY: check_k8s_version
@@ -33,20 +29,35 @@ ifeq (,$(K8S_VERSION))
3329
$(error "K8S_VERSION must be set to a Kubernetes release version")
3430
endif
3531

32+
.PHONY: all
33+
all: release
34+
3635
.PHONY: release
37-
TOOLS_DIR ?= tools/bin
38-
SCRIPTS_DIR ?= tools/scripts
39-
release: check_tag check_k8s_version changelog ## Release all operator-sdk binaries with notes. $TAG must be explicitly set to avoid ambiguity.
36+
release: check_git_version check_k8s_version ## Release all operator-sdk binaries with notes. $GIT_VERSION must be explicitly set to avoid ambiguity.
4037
$(SCRIPTS_DIR)/fetch goreleaser
41-
GORELEASER_CURRENT_TAG=$(TAG) K8S_VERSION=$(K8S_VERSION) $(TOOLS_DIR)/goreleaser $(SNAPSHOT_FLAGS) --release-notes=changelog/generated/$(TAG).md --parallelism 5
38+
GORELEASER_CURRENT_TAG=$(GIT_VERSION) K8S_VERSION=$(K8S_VERSION) $(TOOLS_DIR)/goreleaser $(SNAPSHOT_FLAGS) --release-notes=changelog/generated/$(GIT_VERSION).md --parallelism 5
39+
40+
.PHONY: prerelease
41+
prerelease: check_git_version changelog
42+
./website/scripts/update_mappings.sh $(RELEASE_VERSION)
4243

4344
.PHONY: changelog
44-
changelog: check_tag ## Generate the changelog.
45-
@mkdir -p changelog/generated
46-
go run ./release/changelog/gen-changelog.go -tag=$(TAG) -changelog=changelog/generated/$(TAG).md
47-
ifeq ($(DRY_RUN),)
45+
changelog: check_git_version ## Generate the changelog.
46+
@mkdir -p changelog/generated && rm -f changelog/generated/$(GIT_VERSION).md
47+
go run ./release/changelog/gen-changelog.go -tag=$(GIT_VERSION) -changelog=changelog/generated/$(GIT_VERSION).md
4848
rm -f ./changelog/fragments/!(00-template.yaml)
49+
50+
.PHONY: tag
51+
VERSION_REGEXP := ^v[0-9]+\.[0-9]+\.[0-9]+(\-(alpha|beta|rc)\.[0-9]+)?$
52+
tag:
53+
ifeq (,$(RELEASE_VERSION))
54+
$(error "RELEASE_VERSION must be set to tag HEAD")
55+
endif
56+
ifeq (,$(shell [[ "$(RELEASE_VERSION)" =~ $(VERSION_REGEXP) ]] && echo 1))
57+
$(error "Version $(RELEASE_VERSION) must match regexp $(VERSION_REGEXP)")
4958
endif
59+
git tag --sign --message "Operator SDK $(RELEASE_VERSION)" $(RELEASE_VERSION)
60+
git verify-tag --verbose $(RELEASE_VERSION)
5061

5162
.PHONY: release
5263
K8S_VERSION = v1.18.2

website/config.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ algolia_docsearch = false
9494
version = "Latest Release"
9595
url = "https://sdk.operatorframework.io"
9696

97+
##RELEASE_ADDME##
98+
9799
[[params.versions]]
98100
version = "v1.1"
99101
url = "https://v1-1-x.sdk.operatorframework.io"
@@ -157,7 +159,7 @@ no = 'Sorry to hear that. Please <a href="https://github.com/operator-framework/
157159
name = "github"
158160
url = "https://github.com/operator-framework/operator-sdk"
159161
icon = "fab fa-github"
160-
162+
161163
#[[params.links.social]]
162164
# name = "slack"
163165
# url = "https://example.org/mail"

website/content/en/docs/contribution-guidelines/developer-guide.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,6 @@ as an environment variable in `.travis.yml`, ex. `export SCORECARD_TEST_IMAGE=<r
5555
- Create a PR to the operator-sdk repo with a description containing a link to the Travis build page
5656
showing a successful deployment stage with your changes.
5757

58-
## Generating Samples
59-
60-
To generate the samples run:
61-
62-
```sh
63-
$ make samples
64-
```
65-
66-
## Generating the docs
67-
68-
To generate the CLI docs run:
69-
70-
```sh
71-
$ make cli-doc
72-
```
73-
7458
[git-tool]:https://git-scm.com/downloads
7559
[go-tool]:https://golang.org/dl/
7660
[repo-sdk]:https://github.com/operator-framework/operator-sdk

0 commit comments

Comments
 (0)