2021-07-21 05:14:22 +00:00
|
|
|
IMAGE_REPO=ghcr.io/infracloudio/botkube
|
2019-03-05 13:49:27 +00:00
|
|
|
TAG=$(shell cut -d'=' -f2- .release)
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := build
|
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"
}
}
]
}
```
2021-08-19 05:26:22 +00:00
|
|
|
.PHONY: release git-tag check-git-status build pre-build publish test system-check
|
2019-03-05 13:49:27 +00:00
|
|
|
|
2020-10-05 04:23:36 +00:00
|
|
|
# Show this help.
|
|
|
|
help:
|
|
|
|
@awk '/^#/{c=substr($$0,3);next}c&&/^[[:alpha:]][[:alnum:]_-]+:/{print substr($$1,1,index($$1,":")),c}1{c=0}' $(MAKEFILE_LIST) | column -s: -t
|
|
|
|
|
|
|
|
# Docker Tasks
|
|
|
|
# Make a release
|
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"
}
}
]
}
```
2021-08-19 05:26:22 +00:00
|
|
|
release: check-git-status test git-tag gorelease
|
|
|
|
@echo "Successfully released version $(TAG)"
|
2019-03-05 13:49:27 +00:00
|
|
|
|
2020-10-05 04:23:36 +00:00
|
|
|
# Create a git tag
|
2019-03-05 13:49:27 +00:00
|
|
|
git-tag:
|
|
|
|
@echo "Creating a git tag"
|
2019-06-07 13:53:30 +00:00
|
|
|
@git add .release helm/botkube deploy-all-in-one.yaml deploy-all-in-one-tls.yaml CHANGELOG.md
|
|
|
|
@git commit -m "Release $(TAG)" ;
|
2019-03-05 13:49:27 +00:00
|
|
|
@git tag $(TAG) ;
|
2019-06-07 13:53:30 +00:00
|
|
|
@git push --tags origin develop;
|
2019-03-05 13:49:27 +00:00
|
|
|
@echo 'Git tag pushed successfully' ;
|
|
|
|
|
2020-10-05 04:23:36 +00:00
|
|
|
# Check git status
|
2019-03-05 13:49:27 +00:00
|
|
|
check-git-status:
|
|
|
|
@echo "Checking git status"
|
2019-06-07 13:53:30 +00:00
|
|
|
@if [ -n "$(shell git tag | grep $(TAG))" ] ; then echo 'ERROR: Tag already exists' && exit 1 ; fi
|
|
|
|
@if [ -z "$(shell git remote -v)" ] ; then echo 'ERROR: No remote to push tags to' && exit 1 ; fi
|
|
|
|
@if [ -z "$(shell git config user.email)" ] ; then echo 'ERROR: Unable to detect git credentials' && exit 1 ; fi
|
2019-03-05 13:49:27 +00:00
|
|
|
|
2019-08-26 07:09:32 +00:00
|
|
|
# test
|
|
|
|
test: system-check
|
|
|
|
@echo "Starting unit and integration tests"
|
|
|
|
@./hack/runtests.sh
|
2019-08-08 11:52:52 +00:00
|
|
|
|
2020-10-05 04:23:36 +00:00
|
|
|
# Build the binary
|
2019-06-07 06:19:45 +00:00
|
|
|
build: pre-build
|
2022-02-14 16:52:36 +00:00
|
|
|
@cd cmd/botkube;GOOS_VAL=$(shell go env GOOS) CGO_ENABLED=0 GOARCH_VAL=$(shell go env GOARCH) go build -o $(shell go env GOPATH)/bin/botkube
|
2019-08-12 17:08:50 +00:00
|
|
|
@echo "Build completed successfully"
|
2020-10-05 04:23:36 +00:00
|
|
|
|
|
|
|
# Build the image
|
2019-08-08 11:52:52 +00:00
|
|
|
container-image: pre-build
|
2019-03-05 13:49:27 +00:00
|
|
|
@echo "Building docker image"
|
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"
}
}
]
}
```
2021-08-19 05:26:22 +00:00
|
|
|
@./hack/goreleaser.sh build
|
2019-03-05 13:49:27 +00:00
|
|
|
@echo "Docker image build successfully"
|
|
|
|
|
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"
}
}
]
}
```
2021-08-19 05:26:22 +00:00
|
|
|
# Publish release using goreleaser
|
|
|
|
gorelease:
|
|
|
|
@echo "Publishing release with goreleaser"
|
|
|
|
@./hack/goreleaser.sh release
|
|
|
|
|
2022-05-23 07:01:52 +00:00
|
|
|
# Build project and push dev images with v9.99.9-dev tag ("dev-vality" for fork)
|
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"
}
}
]
}
```
2021-08-19 05:26:22 +00:00
|
|
|
release-snapshot:
|
|
|
|
@./hack/goreleaser.sh release_snapshot
|
|
|
|
|
2020-10-05 04:23:36 +00:00
|
|
|
# system checks
|
2019-08-08 11:52:52 +00:00
|
|
|
system-check:
|
2019-03-05 13:49:27 +00:00
|
|
|
@echo "Checking system information"
|
2019-08-08 11:52:52 +00:00
|
|
|
@if [ -z "$(shell go env GOOS)" ] || [ -z "$(shell go env GOARCH)" ] ; \
|
|
|
|
then \
|
|
|
|
echo 'ERROR: Could not determine the system architecture.' && exit 1 ; \
|
|
|
|
else \
|
|
|
|
echo 'GOOS: $(shell go env GOOS)' ; \
|
|
|
|
echo 'GOARCH: $(shell go env GOARCH)' ; \
|
|
|
|
echo 'System information checks passed.'; \
|
|
|
|
fi ;
|
2019-03-05 13:49:27 +00:00
|
|
|
|
2020-10-05 04:23:36 +00:00
|
|
|
# Pre-build checks
|
2019-08-08 11:52:52 +00:00
|
|
|
pre-build: system-check
|
2019-03-05 13:49:27 +00:00
|
|
|
|
2020-10-05 04:23:36 +00:00
|
|
|
# Create KIND cluster
|
|
|
|
create-kind: system-check
|
|
|
|
@./hack/kind-cluster.sh create-kind
|
|
|
|
|
|
|
|
# Destroy KIND cluster
|
|
|
|
destroy-kind: system-check
|
|
|
|
@./hack/kind-cluster.sh destroy-kind
|
|
|
|
|