Skip to content

Commit

Permalink
feat: add Anexia webhook
Browse files Browse the repository at this point in the history
This commit introduces the Anexia webhook as an webhook provider for the externalDNS project.
  • Loading branch information
ProbstenHias committed May 6, 2024
1 parent 09e06a2 commit 282406b
Show file tree
Hide file tree
Showing 24 changed files with 2,764 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .conform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
policies:
- type: commit
spec:
header:
length: 200
imperative: true
case: lower
invalidLastCharacters: .
body:
required: false
dco: false
gpg: false
spellcheck:
locale: US
maximumOfOneCommit: false
conventional:
types:
- refactor
- perf
- chore
- test
- docs
- no_type
scopes:
- release
- deps
- ci
descriptionLength: 100
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: daily
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
- package-ecosystem: docker
directory: /
schedule:
interval: daily
150 changes: 150 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
name: Verify

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read
pull-requests: read
packages: read
id-token: write

env:
GO111MODULE: "on"

jobs:
conform:
runs-on: ubuntu-latest
name: Conform

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: siderolabs/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}

lint_provider:
runs-on: ubuntu-latest
name: Lint Provider
strategy:
max-parallel: 4
matrix:
go-version: [1.22.x]
golangci-lint-version: [v1.54.2]

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

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "${{ matrix.go-version }}"

- name: Lint Provider
uses: golangci/golangci-lint-action@v5
with:
version: "${{ matrix.golangci-lint-version }}"
args: -c .golangci.yml

- name: Vet Provider
run: |
go vet ./...
test:
runs-on: ubuntu-latest
name: Unit Tests
strategy:
max-parallel: 4
matrix:
go-version: [1.22.x]

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

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "${{ matrix.go-version }}"

- name: Run Tests
run: |
make test
- run: |
go install github.com/mattn/goveralls@latest
goveralls -coverprofile=covprofile -service=github
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dockerfile_lint:
runs-on: ubuntu-latest
name: Lint Dockerfile

steps:
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
with:
fetch-depth: 0

- name: Lint Dockerfile
uses: hadolint/[email protected]
with:
dockerfile: Dockerfile

build:
runs-on: ubuntu-latest
name: Build Provider and Container
needs:
- lint_provider
- dockerfile_lint
- test
strategy:
max-parallel: 4
matrix:
go-version: [1.22.x]

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

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "${{ matrix.go-version }}"

- name: Install cosign
uses: sigstore/[email protected]
- name: Download Syft
uses: anchore/sbom-action/[email protected]

- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Release via GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
args: -p 3 release --snapshot --clean --skip=publish --timeout 60m0s
version: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI_COMMIT_TIMESTAMP: ${{ github.event.pull_request.updated_at }}
CI_COMMIT_SHA: ${{ github.sha }}
CI_COMMIT_TAG: ${{ github.sha }}-dev
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea/
.vscode/
build/
dist/
reports/

covprofile
20 changes: 20 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
linters:
enable:
- errcheck
- revive
- govet
- ineffassign
- lll
- gosimple
- staticcheck
- unused
- misspell
- nakedret
- unconvert
- unused
enable-all: false
linters-settings:
lll:
line-length: 250
run:
timeout: 10m
120 changes: 120 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
---
archives:
- id: archive
name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
builds:
- binary: external-dns-anexia-webhook
env:
- CGO_ENABLED=0
- GO111MODULE=on
goarch:
- amd64
- arm64
- arm
goos:
- darwin
- windows
- linux
goarm:
- "7"
ldflags:
- -X 'main.Version={{ .Tag }}'
- -X 'main.Gitsha={{ .ShortCommit }}'
main: ./cmd/webhook
source:
enabled: true
signs:
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
certificate: "${artifact}.pem"
args:
- sign-blob
- --yes
- "--output-certificate=${certificate}"
- "--bundle=${signature}"
- "${artifact}"
artifacts: all
output: true
sboms:
- artifacts: archive
- id: source
artifacts: source
dockers:
- use: buildx
goos: linux
goarch: amd64
image_templates:
- ghcr.io/probstenhias/external-dns-anexia-webhook:latest-amd64
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_SHA }}-amd64
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_TAG }}-amd64
build_flag_templates:
- --pull
- --platform=linux/amd64
- --build-arg=CI_COMMIT_TIMESTAMP="{{ .Env.CI_COMMIT_TIMESTAMP }}"
- --build-arg=CI_COMMIT_SHA="{{ .Env.CI_COMMIT_SHA }}"
- --build-arg=CI_COMMIT_TAG="{{ .Env.CI_COMMIT_TAG }}"
- use: buildx
goos: linux
goarch: arm64
image_templates:
- ghcr.io/probstenhias/external-dns-anexia-webhook:latest-arm64
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_SHA }}-arm64
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_TAG }}-arm64
build_flag_templates:
- --pull
- --platform=linux/arm64
- --build-arg=CI_COMMIT_TIMESTAMP="{{ .Env.CI_COMMIT_TIMESTAMP }}"
- --build-arg=CI_COMMIT_SHA="{{ .Env.CI_COMMIT_SHA }}"
- --build-arg=CI_COMMIT_TAG="{{ .Env.CI_COMMIT_TAG }}"
- use: buildx
goos: linux
goarch: arm
goarm: "7"
image_templates:
- ghcr.io/probstenhias/external-dns-anexia-webhook:latest-armv7
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_SHA }}-armv7
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_TAG }}-armv7
build_flag_templates:
- --pull
- --platform=linux/arm/v7
- --build-arg=CI_COMMIT_TIMESTAMP="{{ .Env.CI_COMMIT_TIMESTAMP }}"
- --build-arg=CI_COMMIT_SHA="{{ .Env.CI_COMMIT_SHA }}"
- --build-arg=CI_COMMIT_TAG="{{ .Env.CI_COMMIT_TAG }}"
docker_manifests:
- name_template: ghcr.io/probstenhias/external-dns-anexia-webhook:latest
image_templates:
- ghcr.io/probstenhias/external-dns-anexia-webhook:latest-amd64
- ghcr.io/probstenhias/external-dns-anexia-webhook:latest-arm64
- ghcr.io/probstenhias/external-dns-anexia-webhook:latest-armv7
- name_template: ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_SHA }}
image_templates:
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_SHA }}-amd64
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_SHA }}-arm64
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_SHA }}-armv7
- name_template: ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_TAG }}
image_templates:
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_TAG }}-amd64
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_TAG }}-arm64
- ghcr.io/probstenhias/external-dns-anexia-webhook:{{ .Env.CI_COMMIT_TAG }}-armv7
changelog:
skip: true
use: github
filters:
exclude:
- "^docs"
- "^chore"
groups:
- title: "New Features"
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: "Bugfixes"
regexp: "^.*fix[(\\w)]*:+.*$"
order: 10
- title: Other Work
order: 999
release:
disable: false
prerelease: auto
snapshot:
name_template: "{{ .Tag }}-SNAPSHOT"
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM gcr.io/distroless/static-debian12:nonroot

USER 20000:20000
COPY --chmod=555 external-dns-anexia-webhook /opt/external-dns-anexia-webhook/app

ENTRYPOINT ["/opt/external-dns-ionos-webhook/app"]
Loading

0 comments on commit 282406b

Please sign in to comment.