Skip to content

Commit

Permalink
update build pipeline
Browse files Browse the repository at this point in the history
Update to go 1.22.x
  • Loading branch information
gcleroux committed Sep 12, 2024
1 parent 589df29 commit 2258220
Show file tree
Hide file tree
Showing 12 changed files with 221 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@networkop
@gcleroux
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
# Linting is in a separate job because golangci-lint is quite slow when
Expand All @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x
- name: Checkout code
uses: actions/checkout@v3
- name: golangci-lint
Expand All @@ -28,6 +28,6 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.21.x
go-version: 1.22.x
- uses: actions/checkout@v2
- run: make test
37 changes: 22 additions & 15 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,37 @@ name: docker

on:
push:
branches: [ master ]
branches: [master]

jobs:
docker:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
-
name: Checkout code
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.21.x
-
name: Set up Docker Buildx
go-version: 1.22.x
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to Container Registry
uses: docker/login-action@v1

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and Push container images
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push container images
run: |
make docker
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
74 changes: 53 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@ name: release
on:
push:
tags:
- '*'
- "*"

jobs:
go-release:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
-
name: Run GoReleaser
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
Expand All @@ -29,27 +26,62 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker-release:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.21.x
-
name: Set up Docker Buildx
go-version: 1.22.x

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to Container Registry
uses: docker/login-action@v1

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and Push container images
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push container images
run: |
make release
make release
helm-oci-release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
packages: write
outputs:
chart-digest: ${{ steps.helm_publish.outputs.digest }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: "Extract Version"
id: extract_version
run: |
GIT_TAG=${GITHUB_REF##*/}
VERSION=${GIT_TAG##*v}
echo "version=$(echo $VERSION)" >> $GITHUB_OUTPUT
- name: Helm | Publish
id: helm_publish
uses: peak-scale/github-actions/helm-oci-chart@38322faabccd75abfa581c435e367d446b6d2c3b # v0.1.0
with:
registry: ghcr.io
repository: ${{ github.repository_owner }}/charts
name: "k8s-gateway"
version: ${{ steps.extract_version.outputs.version }}
app-version: ${{ steps.extract_version.outputs.version }}
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.GITHUB_TOKEN }}
update-dependencies: "true" # Defaults to false

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.21.5 as builder
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.22.7 AS builder

ARG LDFLAGS

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LDFLAGS := "-s -w -X github.com/coredns/coredns/coremain.GitCommit=$(COMMIT)"
ARCHS := "linux/amd64,linux/arm64,linux/mips64"

# Where to push the docker image.
REGISTRY ?= quay.io/oriedge
REGISTRY ?= ghcr.io/pinax-network


# Image URL to use all building/pushing image targets
Expand Down
77 changes: 64 additions & 13 deletions apex_dual_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,54 @@ import (

func setupEmptyLookupFuncs() {
if resource := lookupResource("HTTPRoute"); resource != nil {
resource.lookup = func(_ []string) []netip.Addr { return []netip.Addr{} }
resource.lookup = func(_ []string) []interface{} {
addrs := []netip.Addr{}
result := make([]interface{}, len(addrs))
for i, addr := range addrs {
result[i] = addr
}
return result
}
}
if resource := lookupResource("TLSRoute"); resource != nil {
resource.lookup = func(_ []string) []netip.Addr { return []netip.Addr{} }
resource.lookup = func(_ []string) []interface{} {
addrs := []netip.Addr{}
result := make([]interface{}, len(addrs))
for i, addr := range addrs {
result[i] = addr
}
return result
}
}
if resource := lookupResource("GRPCRoute"); resource != nil {
resource.lookup = func(_ []string) []netip.Addr { return []netip.Addr{} }
resource.lookup = func(_ []string) []interface{} {
addrs := []netip.Addr{}
result := make([]interface{}, len(addrs))
for i, addr := range addrs {
result[i] = addr
}
return result
}
}
if resource := lookupResource("Ingress"); resource != nil {
resource.lookup = func(_ []string) []netip.Addr { return []netip.Addr{} }
resource.lookup = func(_ []string) []interface{} {
addrs := []netip.Addr{}
result := make([]interface{}, len(addrs))
for i, addr := range addrs {
result[i] = addr
}
return result
}
}
if resource := lookupResource("Service"); resource != nil {
resource.lookup = func(_ []string) []netip.Addr { return []netip.Addr{} }
resource.lookup = func(_ []string) []interface{} {
addrs := []netip.Addr{}
result := make([]interface{}, len(addrs))
for i, addr := range addrs {
result[i] = addr
}
return result
}
}
}

Expand Down Expand Up @@ -69,7 +104,9 @@ var testsDualNS = []test.Case{
Qname: "example.com.", Qtype: dns.TypeSOA,
Rcode: dns.RcodeSuccess,
Answer: []dns.RR{
test.SOA("example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
test.SOA(
"example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5",
),
},
},
{
Expand All @@ -88,42 +125,54 @@ var testsDualNS = []test.Case{
Qname: "example.com.", Qtype: dns.TypeSRV,
Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
test.SOA("example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
test.SOA(
"example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5",
),
},
},
{
Qname: "example.com.", Qtype: dns.TypeA,
Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
test.SOA("example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
test.SOA(
"example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5",
),
},
},
{
Qname: "dns1.kube-system.example.com.", Qtype: dns.TypeSRV,
Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
test.SOA("example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
test.SOA(
"example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5",
),
},
},
{
Qname: "dns1.kube-system.example.com.", Qtype: dns.TypeNS,
Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
test.SOA("example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
test.SOA(
"example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5",
),
},
},
{
Qname: "dns1.kube-system.example.com.", Qtype: dns.TypeSOA,
Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
test.SOA("example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
test.SOA(
"example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5",
),
},
},
{
Qname: "dns1.kube-system.example.com.", Qtype: dns.TypeAAAA,
Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
test.SOA("example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
test.SOA(
"example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5",
),
},
},
{
Expand All @@ -137,7 +186,9 @@ var testsDualNS = []test.Case{
Qname: "foo.dns1.kube-system.example.com.", Qtype: dns.TypeA,
Rcode: dns.RcodeNameError,
Ns: []dns.RR{
test.SOA("example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
test.SOA(
"example.com. 60 IN SOA dns1.kube-system.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5",
),
},
},
}
Expand Down
5 changes: 2 additions & 3 deletions cmd/coredns.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

_ "github.com/coredns/coredns/core/plugin"
_ "github.com/ori-edge/k8s_gateway"
_ "github.com/pinax-network/k8s_gateway"

"github.com/coredns/caddy"
"github.com/coredns/coredns/core/dnsserver"
Expand All @@ -16,7 +16,7 @@ var dropPlugins = map[string]bool{
"k8s_external": true,
}

const pluginVersion = "0.4.0"
const pluginVersion = "0.5.0"

func init() {
var directives []string
Expand All @@ -35,7 +35,6 @@ func init() {
}

dnsserver.Directives = directives

}

func main() {
Expand Down
Loading

0 comments on commit 2258220

Please sign in to comment.