diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a74b81b6d73e..db9ebf3d601a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -10,20 +10,24 @@ on: required: true permissions: + packages: write contents: read jobs: docker-release: runs-on: ubuntu-latest env: - DOCKER_LOGIN: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} RELEASE: ${{ github.event.inputs.release || github.event.release.tag_name }} steps: - uses: actions/checkout@v4 - name: Build Docker Images - run: make VERSION=${RELEASE:1} DOCKER=coredns -f Makefile.docker release + run: make VERSION=${RELEASE:1} GITHUB_USER=${{ github.actor }} -f Makefile.docker release + - name: Set up qemu + uses: docker/setup-qemu-action@v2 + - name: Login registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Show Docker Images run: docker images - name: Publish Docker Images - run: make VERSION=${RELEASE:1} DOCKER=coredns -f Makefile.docker docker-push + run: make VERSION=${RELEASE:1} GITHUB_USER=${{ github.actor }} -f Makefile.docker docker-push diff --git a/.github/workflows/push-images.yml b/.github/workflows/push-images.yml deleted file mode 100644 index 9e0e607eec41..000000000000 --- a/.github/workflows/push-images.yml +++ /dev/null @@ -1,29 +0,0 @@ -# This workflow will build a golang project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go - -name: Go - -on: - push: - tags: - - "v*.*.*" - -jobs: - push-images: - runs-on: ubuntu-latest - permissions: write-all - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up qemu - uses: docker/setup-qemu-action@v2 - - name: Login registry - run: | - echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - name: Push images - env: - ON_PLUGINS: true - run: | - make upload-images diff --git a/Dockerfile b/Dockerfile index f75519b4b2e6..5d7c8d667847 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ ARG DEBIAN_IMAGE=debian:stable-slim -ARG BASE=gcr.io/distroless/static-debian11:nonroot -FROM --platform=$BUILDPLATFORM ${DEBIAN_IMAGE} AS build +FROM --platform=$BUILDPLATFORM ${DEBIAN_IMAGE} SHELL [ "/bin/sh", "-ec" ] RUN export DEBCONF_NONINTERACTIVE_SEEN=true \ @@ -9,14 +8,12 @@ RUN export DEBCONF_NONINTERACTIVE_SEEN=true \ TERM=linux ; \ apt-get -qq update ; \ apt-get -yyqq upgrade ; \ - apt-get -yyqq install ca-certificates libcap2-bin; \ + apt-get -yyqq install ca-certificates ; \ apt-get clean -COPY coredns /coredns -RUN setcap cap_net_bind_service=+ep /coredns -FROM --platform=$TARGETPLATFORM ${BASE} -COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=build /coredns /coredns -USER nonroot:nonroot +FROM --platform=$TARGETPLATFORM scratch +COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +ADD coredns /coredns + EXPOSE 53 53/udp ENTRYPOINT ["/coredns"] diff --git a/Makefile b/Makefile index f1c0b9745150..43d03e207baf 100644 --- a/Makefile +++ b/Makefile @@ -7,27 +7,13 @@ BUILDOPTS:=-v GOPATH?=$(HOME)/go MAKEPWD:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) CGO_ENABLED?=0 -GOOS?=linux -GOARCH?=amd64 -VERSION?=latest -REGISTRY?="ghcr.io/kosmos-io" .PHONY: all all: coredns .PHONY: coredns coredns: $(CHECKS) - CGO_ENABLED=$(CGO_ENABLED) GOOS=${GOOS} GOARCH=${GOARCH} go build $(BUILDOPTS) -ldflags="-s -w -X github.com/coredns/coredns/coremain.GitCommit=$(GITCOMMIT)" -o $(BINARY) - -.PHONY: images -images: coredns - set -e;\ - docker buildx build --output=type=docker --platform ${GOOS}/${GOARCH} --tag ${REGISTRY}/coredns:${VERSION} . - -.PHONY: push-images -upload-images: images - @echo "push images to $(REGISTRY)" - docker push ${REGISTRY}/coredns:${VERSION} + CGO_ENABLED=$(CGO_ENABLED) $(SYSTEM) go build $(BUILDOPTS) -ldflags="-s -w -X github.com/coredns/coredns/coremain.GitCommit=$(GITCOMMIT)" -o $(BINARY) .PHONY: check check: core/plugin/zplugin.go core/dnsserver/zdirectives.go diff --git a/Makefile.docker b/Makefile.docker index fb8cb8efee5c..617906b21fbc 100644 --- a/Makefile.docker +++ b/Makefile.docker @@ -25,14 +25,16 @@ ifeq (, $(shell which jq)) $(error "No jq in $$PATH, please install") endif +# GITHUB_USER +GITHUB_USER:= # VERSION is the version we should download and use. VERSION:= # DOCKER is the docker image repo we need to push to. -DOCKER:= +DOCKER:=ghcr.io/$(GITHUB_USER) NAME:=coredns -GITHUB:=https://github.com/coredns/coredns/releases/download +GITHUB:=https://github.com/$(GITHUB_USER)/coredns/releases/download # mips is not in LINUX_ARCH because it's not supported by docker manifest. Keep this list in sync with the one in Makefile.release -LINUX_ARCH:=amd64 arm arm64 mips64le ppc64le s390x riscv64 +LINUX_ARCH:=amd64 arm arm64 DOCKER_IMAGE_NAME:=$(DOCKER)/$(NAME) DOCKER_IMAGE_LIST_VERSIONED:=$(shell echo $(LINUX_ARCH) | sed -e "s~mips64le ~~g" | sed -e "s~[^ ]*~$(DOCKER_IMAGE_NAME):&\-$(VERSION)~g") @@ -102,7 +104,6 @@ else @# Pushes coredns/coredns-$arch:$version images @# Creates manifest for multi-arch image @# Pushes multi-arch image to coredns/coredns:$version - @echo $(DOCKER_PASSWORD) | docker login -u $(DOCKER_LOGIN) --password-stdin @echo Pushing: $(VERSION) to $(DOCKER_IMAGE_NAME) for arch in $(LINUX_ARCH); do \ docker push $(DOCKER_IMAGE_NAME):$${arch}-$(VERSION) ;\ @@ -111,8 +112,4 @@ else docker manifest create --amend $(DOCKER_IMAGE_NAME):latest $(DOCKER_IMAGE_LIST_VERSIONED) docker manifest push --purge $(DOCKER_IMAGE_NAME):$(VERSION) docker manifest push --purge $(DOCKER_IMAGE_NAME):latest - TOKEN=$$(curl -s -H "Content-Type: application/json" -X POST -d "{\"username\":\"$(DOCKER_LOGIN)\",\"password\":\"$(DOCKER_PASSWORD)\"}" "https://hub.docker.com/v2/users/login/" | jq -r .token) ; \ - for arch in $(LINUX_ARCH); do \ - curl -X DELETE -H "Authorization: JWT $${TOKEN}" "https://hub.docker.com/v2/repositories/$(DOCKER_IMAGE_NAME)/tags/$${arch}-$(VERSION)/" ;\ - done endif diff --git a/Makefile.release b/Makefile.release index f28a8ddcdd1a..1131a51957d5 100644 --- a/Makefile.release +++ b/Makefile.release @@ -51,7 +51,7 @@ endif NAME:=coredns VERSION:=$(shell grep 'CoreVersion' coremain/version.go | awk '{ print $$3 }' | tr -d '"') GITHUB:=coredns -LINUX_ARCH:=amd64 arm arm64 mips64le ppc64le s390x mips riscv64 +LINUX_ARCH:=amd64 arm arm64 all: @echo Use the 'release' target to build a release diff --git a/coremain/version.go b/coremain/version.go index a1f993d1189b..d48f06973210 100644 --- a/coremain/version.go +++ b/coremain/version.go @@ -2,7 +2,7 @@ package coremain // Various CoreDNS constants. const ( - CoreVersion = "1.11.1" + CoreVersion = "1.11.2" coreName = "CoreDNS" serverType = "dns" ) diff --git a/notes/coredns-1.11.2.md b/notes/coredns-1.11.2.md new file mode 100644 index 000000000000..ca32875d94df --- /dev/null +++ b/notes/coredns-1.11.2.md @@ -0,0 +1,18 @@ ++++ +title = "CoreDNS-1.11.2 Release" +description = "CoreDNS-1.11.2 Release Notes." +tags = ["Release", "1.11.2", "Notes"] +release = "1.11.2" +date = "2023-10-13T00:00:00+00:00" +author = "kosmos" ++++ + +This version is a customized version of Kosmos, with added multi-cluster support, allowing users to resolve cross-cluster services through CoreDNS. + +## Brought to You By + +wangyizhi1 + +## Noteworthy Changes + +* multi-clusters support \ No newline at end of file