2016-09-18 14:14:01 +01:00
# Makefile for releasing CoreDNS
#
2017-10-30 15:55:41 +00:00
# The release is controlled from coremain/version.go. The version found there is
2020-11-11 19:00:28 +01:00
# used to tag the git repo and to build the assets that are uploaded to GitHub.
2017-08-13 09:41:50 -07:00
#
2019-03-03 14:43:09 +00:00
# The release should be accompanied by release notes in the notes/ subdirectory.
2019-06-26 11:18:03 +01:00
# These are published on coredns.io. For example see: notes/coredns-1.5.1.md
2020-11-11 19:00:28 +01:00
# Use make -f Makefile.release notes to create a skeleton notes document.
2017-08-13 09:41:50 -07:00
#
2023-08-15 15:30:32 -04:00
# For this to work properly you must fetch the tag of the previous release.
2020-11-11 19:00:28 +01:00
# Be sure to prune the PR list a bit, not everything is worthy!
2019-06-26 11:18:03 +01:00
#
# As seen in notes/coredns-1.5.1.md we want to style the notes in the following manner:
#
# * important changes at the top
# * people who committed/review code (the latter is harder to get)
# * Slightly abbreviated list of pull requests merged for this release.
#
# Steps to release, first:
#
# 1. Up the version in coremain/version.go
2021-02-12 13:27:21 +01:00
# 2. Do a make -f Makefile.doc # This has been automated in GitHub, so you can probably skip this step
2019-06-26 11:18:03 +01:00
# 3. go generate
2019-07-03 19:47:38 +01:00
# 4. Send PR to get this merged.
2019-06-26 11:18:03 +01:00
#
# Then:
2017-07-24 08:24:53 -07:00
#
2019-06-26 11:18:03 +01:00
# 1. Open an issue for this release
2019-12-12 15:57:07 +00:00
# 2. In an issue give the command: /release master VERSION
2019-06-26 11:18:03 +01:00
# Where VERSION is the version of the release - the release script double checks this with the
# actual CoreDNS version in coremain/version.go
2019-12-12 15:57:07 +00:00
# 3. (to test as release /release -t master VERSION can be used.
Makefile.release: allow for other docker registries (#1324)
Default to empty DOCKER var so you wont accidently push to the
production dockerhub. But allow to be overriden to you can push
to your registry. This allows you to re-use the CoreDNS makefiles for
your internal CI/CD.
Hacked Makefile with echos:
make DOCKER=bla -f Makefile.release docker-push
Pushing: 1.0.1
for arch in amd64 arm arm64 ppc64le s390x; do \
echo docker push bla/coredns:coredns-$arch ;\
done
docker push bla/coredns:coredns-amd64
docker push bla/coredns:coredns-arm
docker push bla/coredns:coredns-arm64
docker push bla/coredns:coredns-ppc64le
docker push bla/coredns:coredns-s390x
echo manifest-tool push from-args --platforms linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x --template bla/coredns:coredns-ARCH --target bla/coredns:1.0.1
manifest-tool push from-args --platforms linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x --template bla/coredns:coredns-ARCH --target bla/coredns:1.0.1
echo manifest-tool push from-args --platforms linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x --template bla/coredns:coredns-ARCH --target bla/coredns:latest
manifest-tool push from-args --platforms linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x --template bla/coredns:coredns-ARCH --target bla/coredns:latest
2017-12-21 15:34:19 +00:00
#
2018-08-31 19:28:33 +01:00
# See https://github.com/coredns/release for documentation README on what needs to be setup for this to be
2018-07-11 09:56:37 +01:00
# automated (can still be done by hand if needed). Especially what environment variables need to be
2019-06-26 11:18:03 +01:00
# set! This further depends on Caddy being setup and [dreck](https://github.com/miekg/dreck) running as a plugin in Caddy.
Makefile.release: allow for other docker registries (#1324)
Default to empty DOCKER var so you wont accidently push to the
production dockerhub. But allow to be overriden to you can push
to your registry. This allows you to re-use the CoreDNS makefiles for
your internal CI/CD.
Hacked Makefile with echos:
make DOCKER=bla -f Makefile.release docker-push
Pushing: 1.0.1
for arch in amd64 arm arm64 ppc64le s390x; do \
echo docker push bla/coredns:coredns-$arch ;\
done
docker push bla/coredns:coredns-amd64
docker push bla/coredns:coredns-arm
docker push bla/coredns:coredns-arm64
docker push bla/coredns:coredns-ppc64le
docker push bla/coredns:coredns-s390x
echo manifest-tool push from-args --platforms linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x --template bla/coredns:coredns-ARCH --target bla/coredns:1.0.1
manifest-tool push from-args --platforms linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x --template bla/coredns:coredns-ARCH --target bla/coredns:1.0.1
echo manifest-tool push from-args --platforms linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x --template bla/coredns:coredns-ARCH --target bla/coredns:latest
manifest-tool push from-args --platforms linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x --template bla/coredns:coredns-ARCH --target bla/coredns:latest
2017-12-21 15:34:19 +00:00
#
2019-06-26 11:18:03 +01:00
# To release we run, these target from the this Makefile.release ordered like:
2018-07-10 04:35:58 +01:00
# * make release
2018-08-31 19:28:33 +01:00
# * make github-push
2021-02-24 14:35:20 +01:00
#
2021-11-18 21:39:45 +08:00
# Testing this is hard-ish as you don't want to accidentally release a coredns. If not executing the github-push target
2021-09-13 14:47:46 +02:00
# you should be fine.
2021-11-18 21:39:45 +08:00
# Docker image creation and upload are now separate steps, because it often failed before. See the Makefile.docker for
2021-09-14 13:54:22 +02:00
# details.
2016-09-18 14:14:01 +01:00
2021-02-12 13:27:21 +01:00
i f e q ( , $( shell which curl ) )
2018-06-24 11:21:58 -07:00
$( error " No curl in $$ PATH, please install " )
2017-09-15 09:56:20 +01:00
e n d i f
2016-11-27 15:19:41 +00:00
NAME := coredns
2018-01-23 21:10:55 +01:00
VERSION := $( shell grep 'CoreVersion' coremain/version.go | awk '{ print $$3 }' | tr -d '"' )
2017-02-21 20:02:43 +00:00
GITHUB := coredns
2023-07-10 17:49:01 +03:00
LINUX_ARCH := amd64 arm arm64 mips64le ppc64le s390x mips riscv64
2024-03-07 11:23:13 -08:00
GOLANG_VERSION ?= $( shell cat .go-version)
export GOSUMDB = sum.golang.org
export GOTOOLCHAIN = go$( GOLANG_VERSION)
2016-09-18 14:14:01 +01:00
2017-05-12 10:15:34 +01:00
all :
2021-09-13 14:47:46 +02:00
@echo Use the 'release' target to build a release
2016-10-19 20:49:27 +01:00
2021-01-20 15:58:46 +01:00
release : build tar
2017-05-12 10:15:34 +01:00
2016-09-18 14:14:01 +01:00
.PHONY : build
2017-08-13 09:41:50 -07:00
build :
2021-02-24 14:35:20 +01:00
@go version
release: add more build targets (#1179)
* release: add more build targets
This adds amd64, ppc and s390. Rework some other builds/directories.
This builds:
% find build
build
build/darwin
build/darwin/x86_64
build/darwin/x86_64/coredns
build/linux
build/linux/ppc64
build/linux/ppc64/coredns
build/linux/x86_64
build/linux/x86_64/coredns
build/linux/arm64
build/linux/arm64/coredns
build/linux/s390
build/linux/s390/coredns
build/linux/arm
build/linux/arm/coredns
% make -f Makefile.release tar
rm -rf release && mkdir release
tar -zcf release/coredns_0.9.9_linux_x86_64.tgz -C build/linux/x86_64 coredns
tar -zcf release/coredns_0.9.9_darwin_x86_64.tgz -C build/darwin/x86_64 coredns
tar -zcf release/coredns_0.9.9_linux_armv6l.tgz -C build/linux/arm coredns
tar -zcf release/coredns_0.9.9_linux_armv8l.tgz -C build/linux/arm64 coredns
tar -zcf release/coredns_0.9.9_linux_ppc64le.tgz -C build/linux/ppc64 coredns
tar -zcf release/coredns_0.9.9_linux_s390x.tgz -C build/linux/s390 coredns
Checking:
% for i in $(find build -type f); do file $i; done
build/darwin/x86_64/coredns: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS>
build/linux/ppc64/coredns: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, stripped
build/linux/x86_64/coredns: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
build/linux/arm64/coredns: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
build/linux/s390/coredns: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), statically linked, stripped
build/linux/arm/coredns: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
* code review
2017-10-28 03:54:42 +01:00
@echo Cleaning old builds
Makefile: add Windows target (#1199)
While we at it, why not add a target for Windows as well.
This also introduces a VERBOSE option that defaults to -v, but it empty
when releases so that you can actually see what you're building.
Move an @echo out of shell snippet into the Makefile, as that errored
with @echo: command not found.
Sample run and resulting artifacts:
~~~
% make -f Makefile.release build
% find build -type f -exec file {} \;
build/windows/amd64/coredns: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
build/darwin/amd64/coredns: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS>
build/linux/ppc64le/coredns: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, stripped
build/linux/amd64/coredns: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
build/linux/arm/coredns: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
build/linux/s390x/coredns: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), statically linked, stripped
build/linux/arm64/coredns: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
% make -f Makefile.release tar
% find release -type f | sort
release/coredns_0.9.9_darwin_amd64.tgz
release/coredns_0.9.9_linux_amd64.tgz
release/coredns_0.9.9_linux_arm64.tgz
release/coredns_0.9.9_linux_arm.tgz
release/coredns_0.9.9_linux_ppc64le.tgz
release/coredns_0.9.9_linux_s390x.tgz
release/coredns_0.9.9_windows_amd64.tgz
~~~
2017-11-03 13:45:13 +00:00
@rm -rf build && mkdir build
2018-07-10 04:35:58 +01:00
@echo Building: darwin/amd64 - $( VERSION)
2019-03-13 11:07:54 -07:00
mkdir -p build/darwin/amd64 && $( MAKE) coredns BINARY = build/darwin/amd64/$( NAME) SYSTEM = "GOOS=darwin GOARCH=amd64" CHECKS = "" BUILDOPTS = ""
2022-10-26 01:33:20 -04:00
@echo Building: darwin/arm64 - $( VERSION)
mkdir -p build/darwin/arm64 && $( MAKE) coredns BINARY = build/darwin/arm64/$( NAME) SYSTEM = "GOOS=darwin GOARCH=arm64" CHECKS = "" BUILDOPTS = ""
2018-07-10 04:35:58 +01:00
@echo Building: windows/amd64 - $( VERSION)
2018-10-10 09:39:31 -04:00
mkdir -p build/windows/amd64 && $( MAKE) coredns BINARY = build/windows/amd64/$( NAME) .exe SYSTEM = "GOOS=windows GOARCH=amd64" CHECKS = "" BUILDOPTS = ""
2018-07-10 04:35:58 +01:00
@echo Building: linux/$( LINUX_ARCH) - $( VERSION) ; \
2017-11-02 21:21:57 +00:00
for arch in $( LINUX_ARCH) ; do \
2018-10-10 09:39:31 -04:00
mkdir -p build/linux/$$ arch && $( MAKE) coredns BINARY = build/linux/$$ arch/$( NAME) SYSTEM = " GOOS=linux GOARCH= $$ arch " CHECKS = "" BUILDOPTS = "" ; \
2017-11-02 21:21:57 +00:00
done
2016-09-18 14:14:01 +01:00
2016-11-27 15:19:41 +00:00
.PHONY : tar
tar :
2017-10-30 15:55:41 +00:00
@echo Cleaning old releases
Makefile: add Windows target (#1199)
While we at it, why not add a target for Windows as well.
This also introduces a VERBOSE option that defaults to -v, but it empty
when releases so that you can actually see what you're building.
Move an @echo out of shell snippet into the Makefile, as that errored
with @echo: command not found.
Sample run and resulting artifacts:
~~~
% make -f Makefile.release build
% find build -type f -exec file {} \;
build/windows/amd64/coredns: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
build/darwin/amd64/coredns: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS>
build/linux/ppc64le/coredns: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, stripped
build/linux/amd64/coredns: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
build/linux/arm/coredns: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
build/linux/s390x/coredns: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), statically linked, stripped
build/linux/arm64/coredns: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
% make -f Makefile.release tar
% find release -type f | sort
release/coredns_0.9.9_darwin_amd64.tgz
release/coredns_0.9.9_linux_amd64.tgz
release/coredns_0.9.9_linux_arm64.tgz
release/coredns_0.9.9_linux_arm.tgz
release/coredns_0.9.9_linux_ppc64le.tgz
release/coredns_0.9.9_linux_s390x.tgz
release/coredns_0.9.9_windows_amd64.tgz
~~~
2017-11-03 13:45:13 +00:00
@rm -rf release && mkdir release
2017-11-02 10:59:30 -07:00
tar -zcf release/$( NAME) _$( VERSION) _darwin_amd64.tgz -C build/darwin/amd64 $( NAME)
2022-10-26 01:33:20 -04:00
tar -zcf release/$( NAME) _$( VERSION) _darwin_arm64.tgz -C build/darwin/arm64 $( NAME)
2018-08-03 09:49:13 -07:00
tar -zcf release/$( NAME) _$( VERSION) _windows_amd64.tgz -C build/windows/amd64 $( NAME) .exe
2017-11-02 21:21:57 +00:00
for arch in $( LINUX_ARCH) ; do \
tar -zcf release/$( NAME) _$( VERSION) _linux_$$ arch.tgz -C build/linux/$$ arch $( NAME) ; \
done
2016-11-27 15:19:41 +00:00
2018-07-10 04:35:58 +01:00
.PHONY : github -push
2018-07-11 09:56:37 +01:00
github-push :
2020-11-11 19:00:28 +01:00
i f e q ( $( GITHUB_ACCESS_TOKEN ) , )
$( error "Please set the GITHUB_ACCESS_TOKEN environment variable" )
e l s e
2016-11-27 15:19:41 +00:00
@echo Releasing: $( VERSION)
2020-03-24 14:22:43 +08:00
@$( eval RELEASE:= $( shell curl -s -d '{"tag_name": "v$(VERSION)", "name": "v$(VERSION)"}' -H " Authorization: token ${ GITHUB_ACCESS_TOKEN } " " https://api.github.com/repos/ $( GITHUB) / $( NAME) /releases " | grep -m 1 '"id"' | tr -cd '[[:digit:]]' ) )
2018-06-24 11:21:58 -07:00
@echo ReleaseID: $( RELEASE)
2018-10-09 21:56:28 +01:00
@( cd release; for asset in ` ls -A *tgz` ; do \
2018-08-27 21:33:25 +01:00
echo $$ asset; \
2018-06-24 11:21:58 -07:00
curl -o /dev/null -X POST \
-H "Content-Type: application/gzip" \
2020-03-24 16:26:01 +01:00
-H " Authorization: token ${ GITHUB_ACCESS_TOKEN } " \
2018-08-29 07:51:45 +01:00
--data-binary " @ $$ asset " \
2020-03-24 14:22:43 +08:00
" https://uploads.github.com/repos/ $( GITHUB) / $( NAME) /releases/ $( RELEASE) /assets?name= $$ {asset} " ; \
2018-10-09 21:56:28 +01:00
done )
@( cd release; for asset in ` ls -A *tgz` ; do \
2018-08-29 15:17:32 +01:00
sha256sum $$ asset > $$ asset.sha256; \
2018-10-09 21:56:28 +01:00
done )
@( cd release; for asset in ` ls -A *sha256` ; do \
2018-08-28 21:58:35 +01:00
echo $$ asset; \
curl -o /dev/null -X POST \
-H "Content-Type: text/plain" \
2020-03-24 16:26:01 +01:00
-H " Authorization: token ${ GITHUB_ACCESS_TOKEN } " \
2018-08-29 07:51:45 +01:00
--data-binary " @ $$ asset " \
2020-03-24 14:22:43 +08:00
" https://uploads.github.com/repos/ $( GITHUB) / $( NAME) /releases/ $( RELEASE) /assets?name= $$ {asset} " ; \
2018-10-09 21:56:28 +01:00
done )
2020-11-11 19:00:28 +01:00
e n d i f
2016-09-18 14:14:01 +01:00
2018-08-29 15:17:32 +01:00
.PHONY : version
version :
@echo $( VERSION)
2016-09-18 14:14:01 +01:00
.PHONY : clean
clean :
rm -rf release
rm -rf build
2020-01-23 16:06:52 +01:00
2020-11-11 19:00:28 +01:00
.PHONY : notes
notes :
@$( MAKE) -s -f Makefile.release authors
@echo
@$( MAKE) -s -f Makefile.release prs
2020-01-23 16:06:52 +01:00
.PHONY : prs
prs :
2020-11-11 19:00:28 +01:00
@echo "## Noteworthy Changes"
@echo
@git log $$ ( git describe --tags --abbrev= 0) ..HEAD --oneline | awk ' { $$1="";print } ' | sed 's/^ //' | sed -e 's|#\([0-9]\)|https://github.com/coredns/coredns/pull/\1|' | \
grep -v '^build(deps)' | \
grep -v '^auto go mod tidy' | grep -v '^auto remove' | grep -v '^auto make' | sed 's/^/* /'
2020-01-23 16:06:52 +01:00
.PHONY : authors
authors :
2020-11-11 19:00:28 +01:00
@echo "## Brought to You By"
@echo
2021-03-18 09:53:46 +01:00
@git log --pretty= format:'%an' $$ ( git describe --tags --abbrev= 0) ..master | sort -u | grep -v '^coredns-auto' | grep -v '^coredns\[bot\]' | grep -v '^dependabot-preview' | \
2020-11-11 19:00:28 +01:00
tac | cat -n | sed -e 's/^[[:space:]]\+1[[:space:]]\+\(.*\)/\1./' | sed -e 's/^[[:space:]]\+[[:digit:]]\+[[:space:]]\+\(.*\)/\1,/' | tac # comma separate, with dot at the end