Skip to content

Commit 53984ce

Browse files
author
wangyizhi1
committed
fix: release ci
Signed-off-by: wangyizhi1 <[email protected]>
1 parent 82227f2 commit 53984ce

File tree

9 files changed

+41
-68
lines changed

9 files changed

+41
-68
lines changed

.github/workflows/docker.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@ on:
1010
required: true
1111

1212
permissions:
13+
packages: write
1314
contents: read
1415

1516
jobs:
1617
docker-release:
1718
runs-on: ubuntu-latest
1819
env:
19-
DOCKER_LOGIN: ${{ secrets.DOCKERHUB_USERNAME }}
20-
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
2120
RELEASE: ${{ github.event.inputs.release || github.event.release.tag_name }}
2221
steps:
2322
- uses: actions/checkout@v4
2423
- name: Build Docker Images
25-
run: make VERSION=${RELEASE:1} DOCKER=coredns -f Makefile.docker release
24+
run: make VERSION=${RELEASE:1} GITHUB_USER=${{ github.actor }} -f Makefile.docker release
25+
- name: Set up qemu
26+
uses: docker/setup-qemu-action@v2
27+
- name: Login registry
28+
run: |
29+
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
2630
- name: Show Docker Images
2731
run: docker images
2832
- name: Publish Docker Images
29-
run: make VERSION=${RELEASE:1} DOCKER=coredns -f Makefile.docker docker-push
33+
run: make VERSION=${RELEASE:1} GITHUB_USER=${{ github.actor }} -f Makefile.docker docker-push

.github/workflows/push-images.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

Dockerfile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
ARG DEBIAN_IMAGE=debian:stable-slim
2-
ARG BASE=gcr.io/distroless/static-debian11:nonroot
3-
FROM --platform=$BUILDPLATFORM ${DEBIAN_IMAGE} AS build
2+
FROM --platform=$BUILDPLATFORM ${DEBIAN_IMAGE}
43
SHELL [ "/bin/sh", "-ec" ]
54

65
RUN export DEBCONF_NONINTERACTIVE_SEEN=true \
@@ -9,14 +8,12 @@ RUN export DEBCONF_NONINTERACTIVE_SEEN=true \
98
TERM=linux ; \
109
apt-get -qq update ; \
1110
apt-get -yyqq upgrade ; \
12-
apt-get -yyqq install ca-certificates libcap2-bin; \
11+
apt-get -yyqq install ca-certificates ; \
1312
apt-get clean
14-
COPY coredns /coredns
15-
RUN setcap cap_net_bind_service=+ep /coredns
1613

17-
FROM --platform=$TARGETPLATFORM ${BASE}
18-
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
19-
COPY --from=build /coredns /coredns
20-
USER nonroot:nonroot
14+
FROM --platform=$TARGETPLATFORM scratch
15+
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
16+
ADD coredns /coredns
17+
2118
EXPOSE 53 53/udp
2219
ENTRYPOINT ["/coredns"]

Makefile

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,13 @@ BUILDOPTS:=-v
77
GOPATH?=$(HOME)/go
88
MAKEPWD:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
99
CGO_ENABLED?=0
10-
GOOS?=linux
11-
GOARCH?=amd64
12-
VERSION?=latest
13-
REGISTRY?="ghcr.io/kosmos-io"
1410

1511
.PHONY: all
1612
all: coredns
1713

1814
.PHONY: coredns
1915
coredns: $(CHECKS)
20-
CGO_ENABLED=$(CGO_ENABLED) GOOS=${GOOS} GOARCH=${GOARCH} go build $(BUILDOPTS) -ldflags="-s -w -X github.com/coredns/coredns/coremain.GitCommit=$(GITCOMMIT)" -o $(BINARY)
21-
22-
.PHONY: images
23-
images: coredns
24-
set -e;\
25-
docker buildx build --output=type=docker --platform ${GOOS}/${GOARCH} --tag ${REGISTRY}/coredns:${VERSION} .
26-
27-
.PHONY: push-images
28-
upload-images: images
29-
@echo "push images to $(REGISTRY)"
30-
docker push ${REGISTRY}/coredns:${VERSION}
16+
CGO_ENABLED=$(CGO_ENABLED) $(SYSTEM) go build $(BUILDOPTS) -ldflags="-s -w -X github.com/coredns/coredns/coremain.GitCommit=$(GITCOMMIT)" -o $(BINARY)
3117

3218
.PHONY: check
3319
check: core/plugin/zplugin.go core/dnsserver/zdirectives.go

Makefile.docker

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ ifeq (, $(shell which jq))
2525
$(error "No jq in $$PATH, please install")
2626
endif
2727

28+
# GITHUB_USER
29+
GITHUB_USER:=
2830
# VERSION is the version we should download and use.
2931
VERSION:=
3032
# DOCKER is the docker image repo we need to push to.
31-
DOCKER:=
33+
DOCKER:=ghcr.io/$(GITHUB_USER)
3234
NAME:=coredns
33-
GITHUB:=https://github.com/coredns/coredns/releases/download
35+
GITHUB:=https://github.com/$(GITHUB_USER)/coredns/releases/download
3436
# 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
35-
LINUX_ARCH:=amd64 arm arm64 mips64le ppc64le s390x riscv64
37+
LINUX_ARCH:=amd64 arm arm64
3638
DOCKER_IMAGE_NAME:=$(DOCKER)/$(NAME)
3739
DOCKER_IMAGE_LIST_VERSIONED:=$(shell echo $(LINUX_ARCH) | sed -e "s~mips64le ~~g" | sed -e "s~[^ ]*~$(DOCKER_IMAGE_NAME):&\-$(VERSION)~g")
3840

@@ -102,7 +104,6 @@ else
102104
@# Pushes coredns/coredns-$arch:$version images
103105
@# Creates manifest for multi-arch image
104106
@# Pushes multi-arch image to coredns/coredns:$version
105-
@echo $(DOCKER_PASSWORD) | docker login -u $(DOCKER_LOGIN) --password-stdin
106107
@echo Pushing: $(VERSION) to $(DOCKER_IMAGE_NAME)
107108
for arch in $(LINUX_ARCH); do \
108109
docker push $(DOCKER_IMAGE_NAME):$${arch}-$(VERSION) ;\
@@ -111,8 +112,4 @@ else
111112
docker manifest create --amend $(DOCKER_IMAGE_NAME):latest $(DOCKER_IMAGE_LIST_VERSIONED)
112113
docker manifest push --purge $(DOCKER_IMAGE_NAME):$(VERSION)
113114
docker manifest push --purge $(DOCKER_IMAGE_NAME):latest
114-
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) ; \
115-
for arch in $(LINUX_ARCH); do \
116-
curl -X DELETE -H "Authorization: JWT $${TOKEN}" "https://hub.docker.com/v2/repositories/$(DOCKER_IMAGE_NAME)/tags/$${arch}-$(VERSION)/" ;\
117-
done
118115
endif

Makefile.release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ endif
5151
NAME:=coredns
5252
VERSION:=$(shell grep 'CoreVersion' coremain/version.go | awk '{ print $$3 }' | tr -d '"')
5353
GITHUB:=coredns
54-
LINUX_ARCH:=amd64 arm arm64 mips64le ppc64le s390x mips riscv64
54+
LINUX_ARCH:=amd64 arm arm64
5555

5656
all:
5757
@echo Use the 'release' target to build a release

coremain/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package coremain
22

33
// Various CoreDNS constants.
44
const (
5-
CoreVersion = "1.11.1"
5+
CoreVersion = "1.11.2"
66
coreName = "CoreDNS"
77
serverType = "dns"
88
)

notes/coredns-1.11.2.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
+++
2+
title = "CoreDNS-1.11.2 Release"
3+
description = "CoreDNS-1.11.2 Release Notes."
4+
tags = ["Release", "1.11.2", "Notes"]
5+
release = "1.11.2"
6+
date = "2023-10-13T00:00:00+00:00"
7+
author = "kosmos"
8+
+++
9+
10+
This version is a customized version of Kosmos, with added multi-cluster support, allowing users to resolve cross-cluster services through CoreDNS.
11+
12+
## Brought to You By
13+
14+
wangyizhi1
15+
16+
## Noteworthy Changes
17+
18+
* multi-clusters support

plugin/kubernetes/kubernetes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func (k *Kubernetes) InitKubeCache(ctx context.Context) (onStart func() error, o
268268
k.APIConn.Run()
269269
}()
270270

271-
timeout := 5 * time.Second
271+
timeout := 30 * time.Second
272272
timeoutTicker := time.NewTicker(timeout)
273273
defer timeoutTicker.Stop()
274274
logDelay := 500 * time.Millisecond

0 commit comments

Comments
 (0)