-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate goreleaser to produce draft releases when new tags are push…
…ed (#2365) * Makefile: Avoid hardcoding the quay repository in the release target Update the release target and avoid hardcoding the quay.io/operator-framework/olm quay repository and instead use the existing IMAGE_REPO variable defined further up in the Makefile. Update how the $(ver) variable is handled and avoid hardcoding the 'v' prefix when overriding that 'ver' variable in the environment. Signed-off-by: timflannagan <[email protected]> * Integrate goreleaser to automate the building and publishing of multi-arch container images Signed-off-by: timflannagan <[email protected]> * .github/workflows: Add a release workflow for creating draft releases Add a GHA release workflow that's triggered on tags that's responsible for building and pushing multi-arch (i.e. manifestlist) OLM container images using goreleaser. Goreleaser will also create a draft release, and generate a changelog since the previous tag. Rendering the release quickstart manifests is done after goreleaser has created this draft release as there's no easy way to hook this functionality into goreleaser after the docker images/manifestlists have been pushed but before release artifacts are generated. Use the 'softprops/action-gh-release' to update the newly created draft release with these quickstart manifests as assets. Signed-off-by: timflannagan <[email protected]> * .goreleaser: Add support for ppc64le and s390x architectures * .github/workflows: Avoid using the latest goreleaser action version
- Loading branch information
1 parent
33606c9
commit 41261fc
Showing
5 changed files
with
226 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: release | ||
on: | ||
pull_request: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16 | ||
|
||
- name: Get the image tag | ||
if: startsWith(github.ref, 'refs/tags') | ||
run: | | ||
# Source: https://github.community/t/how-to-get-just-the-tag-name/16241/32 | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
echo IMAGE_TAG="${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
fi | ||
- name: Create a draft release | ||
uses: actions/create-release@v1 | ||
id: release | ||
if: startsWith(github.ref, 'refs/tags') | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
draft: true | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
|
||
- name: Docker Login | ||
uses: docker/login-action@v1 | ||
if: startsWith(github.ref, 'refs/tags') | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
if: startsWith(github.ref, 'refs/tags') | ||
with: | ||
version: 0.177.0 | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
IMAGE_REPO: ${{ secrets.QUAY_USERNAME }}/olm | ||
PKG: github.com/operator-framework/operator-lifecycle-manager | ||
|
||
- name: Generate quickstart release manifests | ||
if: startsWith(github.ref, 'refs/tags') | ||
run: make release ver=${{ env.IMAGE_TAG }} IMAGE_REPO=quay.io/${{ secrets.QUAY_USERNAME }}/olm | ||
|
||
- name: Update release artifacts with rendered Kubernetes manifests | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags') | ||
with: | ||
name: ${{ env.IMAGE_TAG }} | ||
files: | | ||
deploy/upstream/quickstart/crds.yaml | ||
deploy/upstream/quickstart/olm.yaml | ||
deploy/upstream/quickstart/install.sh | ||
draft: true | ||
token: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -455,3 +455,5 @@ apiserver.key | |
|
||
!vendor/** | ||
test/e2e-local.image.tar | ||
|
||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
env: | ||
- GO111MODULE=on | ||
- CGO_ENABLED=0 | ||
before: | ||
hooks: | ||
- go mod tidy | ||
- go mod vendor | ||
builds: | ||
- id: olm | ||
main: ./cmd/olm | ||
binary: olm | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- ppc64le | ||
- s390x | ||
tags: | ||
- json1 | ||
flags: | ||
- -mod=vendor | ||
ldflags: | ||
- -X {{ .Env.PKG }}/pkg/version.GitCommit={{ .FullCommit }} | ||
- -X {{ .Env.PKG }}/pkg/version.OLMVersion={{ .Tag }} | ||
- id: catalog | ||
main: ./cmd/catalog | ||
binary: catalog | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- ppc64le | ||
- s390x | ||
tags: | ||
- json1 | ||
flags: | ||
- -mod=vendor | ||
ldflags: | ||
- -X {{ .Env.PKG }}/pkg/version.GitCommit={{ .FullCommit }} | ||
- -X {{ .Env.PKG }}/pkg/version.OLMVersion={{ .Tag }} | ||
- id: cpb | ||
main: ./util/cpb | ||
binary: cpb | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- ppc64le | ||
- s390x | ||
tags: | ||
- json1 | ||
flags: | ||
- -mod=vendor | ||
ldflags: | ||
- -X {{ .Env.PKG }}/pkg/version.GitCommit={{ .FullCommit }} | ||
- -X {{ .Env.PKG }}/pkg/version.OLMVersion={{ .Tag }} | ||
- id: package-server | ||
main: ./cmd/package-server | ||
binary: package-server | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- ppc64le | ||
- s390x | ||
tags: | ||
- json1 | ||
flags: | ||
- -mod=vendor | ||
ldflags: | ||
- -X {{ .Env.PKG }}/pkg/version.GitCommit={{ .FullCommit }} | ||
- -X {{ .Env.PKG }}/pkg/version.OLMVersion={{ .Tag }} | ||
dockers: | ||
- image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-amd64 | ||
dockerfile: Dockerfile.goreleaser | ||
use: buildx | ||
goos: linux | ||
goarch: amd64 | ||
build_flag_templates: | ||
- --platform=linux/amd64 | ||
- image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-arm64 | ||
dockerfile: Dockerfile.goreleaser | ||
use: buildx | ||
goos: linux | ||
goarch: arm64 | ||
build_flag_templates: | ||
- --platform=linux/arm64 | ||
- image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-ppc64le | ||
dockerfile: Dockerfile.goreleaser | ||
use: buildx | ||
goos: linux | ||
goarch: ppc64le | ||
build_flag_templates: | ||
- --platform=linux/ppc64le | ||
- image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-s390x | ||
dockerfile: Dockerfile.goreleaser | ||
use: buildx | ||
goos: linux | ||
goarch: s390x | ||
build_flag_templates: | ||
- --platform=linux/s390x | ||
docker_manifests: | ||
- name_template: quay.io/{{ .Env.IMAGE_REPO }}:v{{ .Major }}.{{ .Minor }} | ||
image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-amd64 | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-arm64 | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-ppc64le | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-s390x | ||
- name_template: quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }} | ||
image_templates: | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-amd64 | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-arm64 | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-ppc64le | ||
- quay.io/{{ .Env.IMAGE_REPO }}:{{ .Tag }}-s390x | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ .Tag }}" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^doc:' | ||
- '^test:' | ||
release: | ||
draft: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM --platform=$BUILDPLATFORM gcr.io/distroless/static:debug | ||
LABEL stage=olm | ||
WORKDIR / | ||
# bundle unpack Jobs require cp at /bin/cp | ||
RUN ["/busybox/ln", "-s", "/busybox/cp", "/bin/cp"] | ||
# copy goreleaser built binaries | ||
COPY olm /bin/olm | ||
COPY catalog /bin/catalog | ||
COPY package-server /bin/package-server | ||
COPY cpb /bin/cpb | ||
EXPOSE 8080 | ||
EXPOSE 5443 | ||
ENTRYPOINT ["/bin/olm"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters