Add goreleaser and bump chart to v1.0.1 (#92)

This commit is contained in:
Marc-Antoine 2022-05-03 18:11:49 +02:00 committed by GitHub
parent 16312f5480
commit dc93125700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 122 additions and 99 deletions

View File

@ -1,60 +1,27 @@
name: Lint and Test Charts
name: Checks
on:
push:
branches: [master]
tags:
- 'v*'
pull_request:
jobs:
docker-build:
go-tests:
name: Run tests
runs-on: ubuntu-latest
name: Building Docker Image
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
images: caddy/ingress
tags: |
type=semver,pattern={{raw}}
type=ref,event=branch
type=ref,event=pr
type=sha
go-version: 1.16
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Test
run: go test -v ./...
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
# Forks don't have push access to docker
if: github.repository == 'caddyserver/ingress'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: ${{ github.repository == 'caddyserver/ingress' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
lint-test:
chart-test-current:
name: Test and lint charts
needs:
- docker-build
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -67,6 +34,11 @@ jobs:
with:
version: v3.8.1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: arm64
- uses: actions/setup-python@v2
with:
python-version: 3.7
@ -77,6 +49,13 @@ jobs:
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --snapshot --rm-dist
- name: Create kind cluster
uses: helm/kind-action@v1.2.0
@ -99,17 +78,8 @@ jobs:
- 172.17.255.1-172.17.255.200
EOF
- name: Get image tag
id: image-tag
run: echo "::set-output name=data::$(echo ${GITHUB_SHA} | cut -c1-7)"
- name: Set current image tag
working-directory: charts/caddy-ingress-controller
# Forks don't have push access to docker so don't use it in tests
if: github.repository == 'caddyserver/ingress'
run: envsubst < ci/test-values.yaml.tpl > ci/test-values.yaml
env:
TAG: ${{ steps.image-tag.outputs.data }}
- name: Load image into Kind cluster
run: kind load docker-image "caddy/ingress:test-image" --name chart-testing
- name: Run chart-testing (install)
run: ct install --config ct.yaml

View File

@ -5,7 +5,7 @@ on:
branches: [master]
paths:
- 'charts/**'
- '.github/workflows/helmchart-release.yml'
- '.github/workflows/release-controller.yml'
jobs:
release:

View File

@ -0,0 +1,36 @@
name: Release Controller
on:
push:
tags:
- 'v*'
jobs:
goreleaser:
runs-on: ubuntu-latest
name: GoReleaser release
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,24 +0,0 @@
name: Go
on:
push:
branches: [ master ]
pull_request:
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
.DS_Store
bin
vendor
.idea/
.idea/
dist/

45
.goreleaser.yaml Normal file
View File

@ -0,0 +1,45 @@
before:
hooks:
- go mod tidy
builds:
- main: ./cmd/caddy
binary: ingress-controller
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm64
dockers:
- image_templates:
- "caddy/ingress:test-image"
use: buildx
dockerfile: Dockerfile
skip_push: "true"
build_flag_templates:
- "--platform=linux/amd64"
- image_templates:
- "caddy/ingress:{{ .Tag }}-amd64"
use: buildx
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/amd64"
- image_templates:
- "caddy/ingress:{{ .Tag }}-arm64v8"
use: buildx
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/arm64/v8"
docker_manifests:
- name_template: "caddy/ingress:{{ .Tag }}"
image_templates:
- "caddy/ingress:{{ .Tag }}-amd64"
- "caddy/ingress:{{ .Tag }}-arm64v8"
release:
disable: true

View File

@ -1,20 +1,10 @@
FROM golang:1.16.7-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY ./cmd ./cmd
COPY ./pkg ./pkg
COPY ./internal ./internal
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./bin/ingress-controller ./cmd/caddy
FROM alpine:latest AS certs
RUN apk --update add ca-certificates
FROM alpine:latest
COPY --from=builder /app/bin/ingress-controller .
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
EXPOSE 80 443
ENTRYPOINT ["/ingress-controller"]
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY ingress-controller /

View File

@ -4,8 +4,8 @@ home: https://github.com/caddyserver/ingress
description: A helm chart for the Caddy Kubernetes ingress controller
icon: https://caddyserver.com/resources/images/caddy-circle-lock.svg
type: application
version: 1.0.0
appVersion: "0.1.0"
version: 1.0.1
appVersion: "0.1.1"
keywords:
- ingress-controller
- caddyserver

View File

@ -0,0 +1,2 @@
image:
tag: test-image

View File

@ -1,2 +0,0 @@
image:
tag: sha-${TAG}

View File

@ -126,6 +126,10 @@
}
]
},
"experimentalSmartSort": {
"$id": "#/properties/ingressController/properties/config/properties/experimentalSmartSort",
"type": "boolean"
},
"metrics": {
"$id": "#/properties/ingressController/properties/config/properties/metrics",
"type": "boolean"

View File

@ -9,7 +9,7 @@ minikube: false
image:
repository: caddy/ingress
pullPolicy: IfNotPresent
tag: "v0.1.0"
tag: "v0.1.1"
imagePullSecrets: []
nameOverride: ""
@ -30,6 +30,7 @@ ingressController:
email: ""
metrics: true
proxyProtocol: false
experimentalSmartSort: false
onDemandTLS: false
# onDemandRateLimitInterval:
# onDemandRateLimitBurst: