Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish multi-arch images with goreleaser (#509)
##### ISSUE TYPE - Feature Pull Request ##### SUMMARY - Switch to goreleaser for building and publishing release - Set BotKube version with build args - Use docker manifest to build multi-arch image - Update CI pipeline to build and push image using goreleaser Fixes #504 ``` $ docker manifest inspect ghcr.io/prasadg193/botkube:latest { "schemaVersion": 2, "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json", "manifests": [ { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "size": 1370, "digest": "sha256:64d94709256eb85452afa06aa15574724266fa6b82b70654ff6b03c467d5a5e4", "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "size": 1160, "digest": "sha256:525d79e629637fd1ae3530223fa380aea26ed299a1fd9ae2787721f4cc33dad5", "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "size": 1160, "digest": "sha256:ef72bc09078929c8aed1161f86c2c86523f6fac664094a034c737ffd582f3ea7", "platform": { "architecture": "arm64", "os": "linux" } }, { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "size": 1160, "digest": "sha256:990cd2c6b522a3a69ba73ee83ed0ae306102369f02d09891de8fbfd024d37e87", "platform": { "architecture": "arm", "os": "linux", "variant": "v7" } } ] } ```
- Loading branch information
1 parent
6ced5ea
commit f349853
Showing
18 changed files
with
285 additions
and
259 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,49 @@ | ||
name: build-artifacts | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
GO111MODULE: on | ||
GOPATH: /home/runner/work/botkube | ||
GOBIN: /home/runner/work/botkube/bin | ||
DOCKER_CLI_EXPERIMENTAL: "enabled" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Docker Login | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run GoReleaser | ||
run: make release_snapshot | ||
- name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.4.0 | ||
- name: Update and publish helm chart | ||
run: | | ||
cd .. | ||
git config --global user.email "botkube-ci@infracloud.io" | ||
git config --global user.name "BotKube CI" | ||
git clone https://github.com/infracloudio/charts.git | ||
cd charts | ||
git fetch | ||
git branch | ||
git pull origin gh-pages | ||
helm package --app-version v9.99.9-dev --version v9.99.9-dev ${{ github.workspace }}/helm/botkube/ | ||
helm repo index --url https://infracloudio.github.io/charts --merge index.yaml . | ||
git add . | ||
git commit -m "Update BotKube latest helm chart" | ||
git push https://${{ secrets.GH_TOKEN }}@github.com/infracloudio/charts.git |
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
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 |
---|---|---|
|
@@ -15,3 +15,7 @@ | |
vendor/ | ||
/.idea/ | ||
/botkube | ||
/dist | ||
|
||
# Tags | ||
tags |
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,58 @@ | ||
before: | ||
hooks: | ||
- go mod download | ||
builds: | ||
- id: botkube | ||
binary: botkube | ||
main: cmd/botkube/main.go | ||
ldflags: &ldflags | ||
- -s -w | ||
-X github.com/infracloudio/botkube/pkg/version.Version={{ .Tag }} | ||
-X github.com/infracloudio/botkube/pkg/version.GitCommitID={{ .Commit }} | ||
-X github.com/infracloudio/botkube/pkg/version.BuildDate={{ .Date }} | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
goarm: | ||
- 7 | ||
snapshot: | ||
name_template: "{{ .Tag }}" | ||
changelog: | ||
skip: true | ||
dockers: | ||
- image_templates: | ||
- 'ghcr.io/infracloudio/botkube:{{ .Tag }}-amd64' | ||
use: buildx | ||
dockerfile: 'build/Dockerfile' | ||
build_flag_templates: | ||
- "--platform=linux/amd64" | ||
- "--build-arg=botkube_version={{ .Tag }}" | ||
- image_templates: | ||
- 'ghcr.io/infracloudio/botkube:{{ .Tag }}-arm64' | ||
use: buildx | ||
goarch: arm64 | ||
dockerfile: 'build/Dockerfile' | ||
build_flag_templates: | ||
- "--platform=linux/arm64" | ||
- "--build-arg=botkube_version={{ .Tag }}" | ||
- image_templates: | ||
- 'ghcr.io/infracloudio/botkube:{{ .Tag }}-armv7' | ||
use: buildx | ||
goarch: arm | ||
goarm: 7 | ||
dockerfile: 'build/Dockerfile' | ||
build_flag_templates: | ||
- "--platform=linux/arm" | ||
- "--build-arg=botkube_version={{ .Tag }}" | ||
|
||
docker_manifests: | ||
- name_template: ghcr.io/infracloudio/botkube:{{ .Tag }} | ||
image_templates: | ||
- ghcr.io/infracloudio/botkube:{{ .Tag }}-amd64 | ||
- ghcr.io/infracloudio/botkube:{{ .Tag }}-arm64 | ||
- ghcr.io/infracloudio/botkube:{{ .Tag }}-armv7 |
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
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
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
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
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
Oops, something went wrong.