Skip to content

Commit dc93125

Browse files
authored
Add goreleaser and bump chart to v1.0.1 (#92)
1 parent 16312f5 commit dc93125

12 files changed

+122
-99
lines changed

.github/workflows/main.yml

+24-54
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,27 @@
1-
name: Lint and Test Charts
1+
name: Checks
22

33
on:
44
push:
55
branches: [master]
6-
tags:
7-
- 'v*'
86
pull_request:
97

108
jobs:
11-
docker-build:
9+
go-tests:
10+
name: Run tests
1211
runs-on: ubuntu-latest
13-
name: Building Docker Image
1412
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v2
17-
18-
- name: Docker meta
19-
id: docker_meta
20-
uses: docker/metadata-action@v3
21-
with:
22-
images: caddy/ingress
23-
tags: |
24-
type=semver,pattern={{raw}}
25-
type=ref,event=branch
26-
type=ref,event=pr
27-
type=sha
28-
29-
- name: Set up QEMU
30-
uses: docker/setup-qemu-action@v1
31-
32-
- name: Set up Docker Buildx
33-
uses: docker/setup-buildx-action@v1
13+
- uses: actions/checkout@v2
3414

35-
- name: Login to DockerHub
36-
# Forks don't have push access to docker
37-
if: github.repository == 'caddyserver/ingress'
38-
uses: docker/login-action@v1
15+
- name: Set up Go
16+
uses: actions/setup-go@v2
3917
with:
40-
username: ${{ secrets.DOCKER_USERNAME }}
41-
password: ${{ secrets.DOCKER_PASSWORD }}
18+
go-version: 1.16
4219

43-
- name: Build and push
44-
id: docker_build
45-
uses: docker/build-push-action@v2
46-
with:
47-
push: ${{ github.repository == 'caddyserver/ingress' }}
48-
tags: ${{ steps.docker_meta.outputs.tags }}
49-
labels: ${{ steps.docker_meta.outputs.labels }}
50-
platforms: linux/amd64,linux/arm64
51-
cache-from: type=gha
52-
cache-to: type=gha,mode=max
20+
- name: Test
21+
run: go test -v ./...
5322

54-
lint-test:
23+
chart-test-current:
5524
name: Test and lint charts
56-
needs:
57-
- docker-build
5825
runs-on: ubuntu-latest
5926
steps:
6027
- name: Checkout
@@ -67,6 +34,11 @@ jobs:
6734
with:
6835
version: v3.8.1
6936

37+
- name: Set up QEMU
38+
uses: docker/setup-qemu-action@v1
39+
with:
40+
platforms: arm64
41+
7042
- uses: actions/setup-python@v2
7143
with:
7244
python-version: 3.7
@@ -77,6 +49,13 @@ jobs:
7749
- name: Run chart-testing (lint)
7850
run: ct lint --config ct.yaml
7951

52+
- name: Run GoReleaser
53+
uses: goreleaser/goreleaser-action@v2
54+
with:
55+
distribution: goreleaser
56+
version: latest
57+
args: release --snapshot --rm-dist
58+
8059
- name: Create kind cluster
8160
uses: helm/[email protected]
8261

@@ -99,17 +78,8 @@ jobs:
9978
- 172.17.255.1-172.17.255.200
10079
EOF
10180
102-
- name: Get image tag
103-
id: image-tag
104-
run: echo "::set-output name=data::$(echo ${GITHUB_SHA} | cut -c1-7)"
105-
106-
- name: Set current image tag
107-
working-directory: charts/caddy-ingress-controller
108-
# Forks don't have push access to docker so don't use it in tests
109-
if: github.repository == 'caddyserver/ingress'
110-
run: envsubst < ci/test-values.yaml.tpl > ci/test-values.yaml
111-
env:
112-
TAG: ${{ steps.image-tag.outputs.data }}
81+
- name: Load image into Kind cluster
82+
run: kind load docker-image "caddy/ingress:test-image" --name chart-testing
11383

11484
- name: Run chart-testing (install)
11585
run: ct install --config ct.yaml

.github/workflows/helmchart-release.yml renamed to .github/workflows/release-chart.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [master]
66
paths:
77
- 'charts/**'
8-
- '.github/workflows/helmchart-release.yml'
8+
- '.github/workflows/release-controller.yml'
99

1010
jobs:
1111
release:
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release Controller
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
name: GoReleaser release
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: 1.16
22+
23+
- name: Login to DockerHub
24+
uses: docker/login-action@v1
25+
with:
26+
username: ${{ secrets.DOCKER_USERNAME }}
27+
password: ${{ secrets.DOCKER_PASSWORD }}
28+
29+
- name: Run GoReleaser
30+
uses: goreleaser/goreleaser-action@v2
31+
with:
32+
distribution: goreleaser
33+
version: latest
34+
args: release --rm-dist
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

-24
This file was deleted.

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
22
bin
33
vendor
4-
.idea/
4+
.idea/
5+
dist/

.goreleaser.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
builds:
5+
- main: ./cmd/caddy
6+
binary: ingress-controller
7+
env:
8+
- CGO_ENABLED=0
9+
goos:
10+
- linux
11+
goarch:
12+
- amd64
13+
- arm64
14+
15+
dockers:
16+
- image_templates:
17+
- "caddy/ingress:test-image"
18+
use: buildx
19+
dockerfile: Dockerfile
20+
skip_push: "true"
21+
build_flag_templates:
22+
- "--platform=linux/amd64"
23+
24+
- image_templates:
25+
- "caddy/ingress:{{ .Tag }}-amd64"
26+
use: buildx
27+
dockerfile: Dockerfile
28+
build_flag_templates:
29+
- "--platform=linux/amd64"
30+
31+
- image_templates:
32+
- "caddy/ingress:{{ .Tag }}-arm64v8"
33+
use: buildx
34+
dockerfile: Dockerfile
35+
build_flag_templates:
36+
- "--platform=linux/arm64/v8"
37+
38+
docker_manifests:
39+
- name_template: "caddy/ingress:{{ .Tag }}"
40+
image_templates:
41+
- "caddy/ingress:{{ .Tag }}-amd64"
42+
- "caddy/ingress:{{ .Tag }}-arm64v8"
43+
44+
release:
45+
disable: true

Dockerfile

+4-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
1-
FROM golang:1.16.7-alpine AS builder
2-
WORKDIR /app
3-
4-
COPY go.mod go.sum ./
5-
RUN go mod download
6-
7-
COPY ./cmd ./cmd
8-
COPY ./pkg ./pkg
9-
COPY ./internal ./internal
10-
11-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./bin/ingress-controller ./cmd/caddy
12-
131
FROM alpine:latest AS certs
142
RUN apk --update add ca-certificates
153

164
FROM alpine:latest
17-
COPY --from=builder /app/bin/ingress-controller .
18-
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
5+
196
EXPOSE 80 443
207
ENTRYPOINT ["/ingress-controller"]
8+
9+
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
10+
COPY ingress-controller /

charts/caddy-ingress-controller/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ home: https://github.com/caddyserver/ingress
44
description: A helm chart for the Caddy Kubernetes ingress controller
55
icon: https://caddyserver.com/resources/images/caddy-circle-lock.svg
66
type: application
7-
version: 1.0.0
8-
appVersion: "0.1.0"
7+
version: 1.0.1
8+
appVersion: "0.1.1"
99
keywords:
1010
- ingress-controller
1111
- caddyserver
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
image:
2+
tag: test-image

charts/caddy-ingress-controller/ci/test-values.yaml.tpl

-2
This file was deleted.

charts/caddy-ingress-controller/values.schema.json

+4
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@
126126
}
127127
]
128128
},
129+
"experimentalSmartSort": {
130+
"$id": "#/properties/ingressController/properties/config/properties/experimentalSmartSort",
131+
"type": "boolean"
132+
},
129133
"metrics": {
130134
"$id": "#/properties/ingressController/properties/config/properties/metrics",
131135
"type": "boolean"

charts/caddy-ingress-controller/values.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ minikube: false
99
image:
1010
repository: caddy/ingress
1111
pullPolicy: IfNotPresent
12-
tag: "v0.1.0"
12+
tag: "v0.1.1"
1313

1414
imagePullSecrets: []
1515
nameOverride: ""
@@ -30,6 +30,7 @@ ingressController:
3030
email: ""
3131
metrics: true
3232
proxyProtocol: false
33+
experimentalSmartSort: false
3334
onDemandTLS: false
3435
# onDemandRateLimitInterval:
3536
# onDemandRateLimitBurst:

0 commit comments

Comments
 (0)