-
Notifications
You must be signed in to change notification settings - Fork 1.8k
*: automate releases with goreleaser #4034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
|
||
# Modified from https://blogs.itemis.com/en/secure-your-travis-ci-releases-part-2-signature-with-openpgp | ||
|
||
function err_exit() { | ||
estroz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
echo "ERROR: ${1:-"Unknown Error"} Exiting." 1>&2 | ||
exit 1 | ||
} | ||
|
||
declare -r GPG_HOME="${DIR}/keyring" | ||
declare -r SECRING_AUTO="${GPG_HOME}/secring.auto" | ||
declare -r PUBRING_AUTO="${GPG_HOME}/pubring.auto" | ||
|
||
mkdir -p "$GPG_HOME" | ||
cp "${DIR}"/*.auto* "${GPG_HOME}" | ||
|
||
echo -e "\nDecrypting secret key..." | ||
{ | ||
# $GPG_PASSWORD is taken from the script's env (injected by Travis CI). | ||
echo $GPG_PASSWORD | gpg --decrypt \ | ||
--pinentry-mode loopback --batch \ | ||
--passphrase-fd 0 \ | ||
--output "${SECRING_AUTO}" \ | ||
"${SECRING_AUTO}".gpg ; \ | ||
} || { err_exit "Failed to decrypt secret key." ; } | ||
echo "Success!" | ||
Comment on lines
+19
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly what we used to do in RHN back in the day when we stored our encrypted keys in CVS. I approve. |
||
|
||
echo -e "\nImporting keys..." | ||
{ gpg --home "${GPG_HOME}" --import "${PUBRING_AUTO}" ; } || { err_exit "Could not import public key into gpg." ; } | ||
{ gpg --home "${GPG_HOME}" --import "${SECRING_AUTO}" ; } || { err_exit "Could not import secret key into gpg." ; } | ||
echo "Success!" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
|
||
mQINBF+clTQBEADMHVz8qS+dcYC0qxlSNe4Yipbr/BtVuWGJay26OAbS4K7sjzs3 | ||
XP+RhjUsJGOnPXn+N/zM6wVNczV7MrdfWNK1UAWBPVC4HjD/ysj/m5lMv/j0RNym | ||
W6VNdSgV4YWyQHn6eD279gT4p6GAVvQj0eXnWtX7eA0SaITi6dMNqw8QcTOBxzFI | ||
PXw+4MDJJKDAammtNKgj6LtmYc3o9d8aqbwtPfj3Vvi5d3SWfMx8a+2aSDkVcsva | ||
bloGUBXYWFzO11T4OYvUYXgQdaKHyT+ZWGCpDsnQV/KqG5S456jmV+Qp+98vwe8k | ||
XhXhlkjauhbvVR0uGAv0RJ4NZPSmWpie6f7ApQ3XTg3+ZvsrTvi3STCkOKA8/CLm | ||
/xRhAF/aFZSOLlgzyAxr45j0PRjzX3XJfPePkV1D1cFso3JGDT5Y2oku8bNqYTof | ||
fV/vw6jxylSNKApn1VyViwZ0+aE9kjMHXytKWWLK+woxrFOG74nGcI+xBOAOHvSU | ||
GRh5EVXydbyMxqEpq2Su+rHlzfzgPh+hORNQgrag+qdbTVMimCoD+datX4854Hkb | ||
nah+mq7RtI0k5Nn+ENm4ufbHEKiNb56qFTNgMkquG5vxpA6NOlZ0QfKUxiDU08+g | ||
Pix7+TY7lzNhGipD7QjqfuJJr+1k3p/GrIpoHlU8/8FvlNYBDG3oMUvxNwARAQAB | ||
tDJPcGVyYXRvciBTREsgKHJlbGVhc2UpIDxjbmNmLW9wZXJhdG9yLXNka0BjbmNm | ||
LmlvPokCVAQTAQgAPhYhBDsvFIHRRiOAgLNGuwUpluKiC1x+BQJfnJU0AhsBBQkD | ||
w7iABQsJCAcCBhUKCQgLAgQWAgMBAh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l7bf9yYTfK | ||
tsrAKPVOMNF7QEdR3UldqoGzkTo55l4omvMS93tWSG+w47W7QIAQjwTlqDyjYVg3 | ||
2l8XlfDtcR0k+Y6ObguEMUwtsikK+FvqVS5ZCPIyvv4kMCIazMlEWocsfvrINjQ4 | ||
II2W+oQv5vJmOyY30tPELq35taH9oOMjtY3KWZVmPzw6+DGRTA2RDR+7qm2v3lgl | ||
i49Nzi/iSBvDeVZxSBHRRjH/OL7TKWN+WwC2I4wYD/4iox1+WcKPsI+77HaULvsP | ||
qa+bXnKbZidrsqSejbPnLg3M9an2gDo0d62QxrnJLl9OhuhObXP/bzCjrcMkg9hY | ||
BAHaTXbRtVlSKpXYEyuwO6HYQ7WyHlY9y9srHIvcWuBrpI9Kgd28rkT4QZB5WJD/ | ||
Cgj4ksJAe+TsSmccdw3zG3OWWVs4HujQnWnh+NbBE7cyYqZaByKiDjL3vKP+0Zfj | ||
M/TF8nnY7zqgSljQxScbW7//U3GiB9DKg1r9TEMzmSTDugwv7u2kM/iZPjq+dvUs | ||
KqKuyX23WDKRLyzusDqIWKsRrkd+g1vBfxSUhWwxtwzyy1rL/tNcXGBuLOxjUit9 | ||
LhdowjFRG93Tswac/Q8VGPEB5XjBgRNlW9vSYgw+5wTHf01UBWgEWtFhl6SJnD6u | ||
AjnMBtduqXBXmncTA6Gz5XB1h7xM32pLncWJGHfixXiJcOgGqW+Lv1Y3eaPqCFOm | ||
4yfYDfBL+UN8Y7sR3WrVy1R6Ut/8bf4sD/i1UyBNKSzeN5sBpi7KgA6yY7PpVIN7 | ||
H7V1QN41Bw9vAG5WXCO8vmY0GoCMQAKM5p04mMuBr6nswy1W94q6uuINwq6q1ycf | ||
YQJyoKhXifPhdicwDMYeuW7aP7WnPIb3VwdtlEyD+ycBsak0Jsq/+yrov3pXgrdL | ||
dlF2O4uTr4frwKRl28eGEQ== | ||
=ebPb | ||
-----END PGP PUBLIC KEY BLOCK----- |
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,90 @@ | ||||||||||||||||||
# Global environment variables for builds. | ||||||||||||||||||
env: | ||||||||||||||||||
- CGO_ENABLED=0 | ||||||||||||||||||
- GO111MODULE=on | ||||||||||||||||||
- GOPROXY=https://proxy.golang.org|direct | ||||||||||||||||||
- REPO=github.com/operator-framework/operator-sdk | ||||||||||||||||||
|
||||||||||||||||||
# Hooks to run before any build is run. | ||||||||||||||||||
before: | ||||||||||||||||||
hooks: | ||||||||||||||||||
- go version | grep --quiet "go1\.15\.5" || echo "Go binary version must be 1.15.5" | ||||||||||||||||||
- go mod download | ||||||||||||||||||
|
||||||||||||||||||
# Binary builds. | ||||||||||||||||||
builds: | ||||||||||||||||||
# operator-sdk build steps | ||||||||||||||||||
- id: operator-sdk | ||||||||||||||||||
main: ./cmd/operator-sdk | ||||||||||||||||||
binary: operator-sdk | ||||||||||||||||||
mod_timestamp: "{{ .CommitTimestamp }}" | ||||||||||||||||||
asmflags: &build-asmflags | ||||||||||||||||||
- all=-trimpath={{ .Env.PWD }} | ||||||||||||||||||
gcflags: &build-gcflags | ||||||||||||||||||
- all=-trimpath={{ .Env.PWD }} | ||||||||||||||||||
ldflags: &build-ldflags | ||||||||||||||||||
- -X {{ .Env.REPO }}/internal/version.Version={{ .Env.SIMPLE_VERSION }} | ||||||||||||||||||
- -X {{ .Env.REPO }}/internal/version.GitVersion={{ .Env.GIT_VERSION }} | ||||||||||||||||||
- -X {{ .Env.REPO }}/internal/version.GitCommit={{ .Env.GIT_COMMIT }} | ||||||||||||||||||
- -X {{ .Env.REPO }}/internal/version.KubernetesVersion={{ .Env.K8S_VERSION }} | ||||||||||||||||||
- -X {{ .Env.REPO }}/internal/version.ImageVersion={{ .Env.IMAGE_VERSION }} | ||||||||||||||||||
targets: &build-targets | ||||||||||||||||||
- darwin_amd64 | ||||||||||||||||||
- linux_amd64 | ||||||||||||||||||
- linux_arm64 | ||||||||||||||||||
- linux_ppc64le | ||||||||||||||||||
- linux_s390x | ||||||||||||||||||
|
||||||||||||||||||
# ansible-operator build steps | ||||||||||||||||||
- id: ansible-operator | ||||||||||||||||||
main: ./cmd/ansible-operator | ||||||||||||||||||
binary: ansible-operator | ||||||||||||||||||
mod_timestamp: "{{ .CommitTimestamp }}" | ||||||||||||||||||
asmflags: *build-asmflags | ||||||||||||||||||
gcflags: *build-gcflags | ||||||||||||||||||
ldflags: *build-ldflags | ||||||||||||||||||
targets: *build-targets | ||||||||||||||||||
Comment on lines
+43
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this reuse of the flags and the fact that if we ever need to change one just for one of the builds, we still have the flexibility to update the flags in this section. |
||||||||||||||||||
|
||||||||||||||||||
# helm-operator build steps | ||||||||||||||||||
- id: helm-operator | ||||||||||||||||||
main: ./cmd/helm-operator | ||||||||||||||||||
binary: helm-operator | ||||||||||||||||||
mod_timestamp: "{{ .CommitTimestamp }}" | ||||||||||||||||||
asmflags: *build-asmflags | ||||||||||||||||||
gcflags: *build-gcflags | ||||||||||||||||||
ldflags: *build-ldflags | ||||||||||||||||||
targets: *build-targets | ||||||||||||||||||
|
||||||||||||||||||
# Use most recent tag and short commit for snapshot version. | ||||||||||||||||||
snapshot: | ||||||||||||||||||
name_template: "{{ .Env.GIT_VERSION }}" | ||||||||||||||||||
|
||||||||||||||||||
# We don't use archives, so skip creating them. | ||||||||||||||||||
archives: | ||||||||||||||||||
- format: binary | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we may need the following to make the binaries have the same naming scheme we've been using:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One caveat: I noticed that our arm64 binary release on github use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it a breaking change to modify the released binary names? If not I'd prefer to use those defined by Golang going forward. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also removing version from binary names removes one more doc we have to change in the release commit (there are other ways around the latter issue, but this is the simplest). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm okay using the Golang arch and os for the binary names. |
||||||||||||||||||
name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}" | ||||||||||||||||||
|
||||||||||||||||||
checksum: | ||||||||||||||||||
name_template: "checksums.txt" | ||||||||||||||||||
|
||||||||||||||||||
# Sign the checksum file with the CI GPG key. | ||||||||||||||||||
signs: | ||||||||||||||||||
- signature: "${artifact}.asc" | ||||||||||||||||||
artifacts: checksum | ||||||||||||||||||
# Use the CI signing subkey A20B5C7E decrypted into .ci/gpg/keyring to sign the release. | ||||||||||||||||||
args: ["--home", ".ci/gpg/keyring", "-u", "A20B5C7E", "--output", "${signature}", "--detach-sign", "${artifact}"] | ||||||||||||||||||
|
||||||||||||||||||
# We use a custom changelog generator. | ||||||||||||||||||
changelog: | ||||||||||||||||||
|
||||||||||||||||||
# TODO(estroz): configure homebrew publishing | ||||||||||||||||||
# brews: | ||||||||||||||||||
# - name: operator-sdk | ||||||||||||||||||
# ids: | ||||||||||||||||||
# - operator-sdk | ||||||||||||||||||
|
||||||||||||||||||
# Uncomment for testing | ||||||||||||||||||
# release: | ||||||||||||||||||
# github: | ||||||||||||||||||
# owner: <your-github-namespace> | ||||||||||||||||||
# name: operator-sdk |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ dist: xenial | |
|
||
language: go | ||
go: | ||
- 1.15.x | ||
- 1.15.5 | ||
go_import_path: github.com/operator-framework/operator-sdk | ||
|
||
cache: | ||
|
@@ -47,12 +47,16 @@ x_base_steps: | |
- docker | ||
|
||
stages: | ||
- check | ||
- test | ||
- name: check | ||
if: type == pull_request | ||
- name: test | ||
if: type == pull_request | ||
Comment on lines
+50
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will we no longer run the check/test on master? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct. We already run PR tests, so testing master post-merge is redundant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only think that we need to run the test/check when we push the release tag. I mean to generate the tag. Otherwise, +1 for me. However, in the latest release meeting, this idea was not accepted. @joelanford @jmrodri are you ok with as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm okay with not running them on master anymore. |
||
- 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\]/ ) | ||
- name: release | ||
if: type != pull_request AND tag IS present | ||
estroz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
jobs: | ||
include: | ||
|
@@ -151,3 +155,12 @@ jobs: | |
name: push manifest lists | ||
<<: *manifest-deploy | ||
script: make -f release/Makefile image-push-multiarch | ||
|
||
## Release jobs ## | ||
|
||
- stage: release | ||
name: publish release | ||
before_install: git fetch origin --unshallow --tags | ||
install: sudo ln -sf $(command -v gpg2) $(dirname $(command -v gpg2))/gpg | ||
before_script: .ci/gpg/create-keyring.sh | ||
script: make release |
Uh oh!
There was an error while loading. Please reload this page.