Skip to content

Commit

Permalink
feat!: Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Kuritka <[email protected]>
  • Loading branch information
kuritka committed May 28, 2024
0 parents commit 7fc064c
Show file tree
Hide file tree
Showing 31 changed files with 3,860 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: GolangCI
on:
push:
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
jobs:
lint:
name: GolangCI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: GolangCI
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.2
args: --timeout=3m
78 changes: 78 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
name: Release

on:
push:
branches:
- main

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

env:
GO111MODULE: "on"

jobs:
release:
runs-on: ubuntu-latest
name: Release
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}

steps:
- uses: googleapis/release-please-action@v4
id: release

provider:
if: needs.release.outputs.release_created
runs-on: ubuntu-latest
name: Publish Provider
needs:
- release
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: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Release via GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
args: -p 3 release --clean --timeout 60m0s
version: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI_COMMIT_TIMESTAMP: ${{ github.event.repository.updated_at }}
CI_COMMIT_SHA: ${{ github.sha }}
CI_COMMIT_TAG: ${{ needs.release.outputs.tag_name }}
27 changes: 27 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Test
on:
push:
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Dependencies
env:
GOPROXY: https://proxy.golang.org,direct
run: go mod download

- name: Test
run: make test
25 changes: 25 additions & 0 deletions .github/workflows/yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: YamlLint
on:
push:
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
jobs:
lint:
name: YamlLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5

- name: YamlLint
run: yamllint .
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Ignore everything
*

# But not these files...
!/.gitignore

!*.go
!go.sum
!go.mod

!Makefile
!*.yaml

!.release-please-manifest.json
!release-please-config.json
!.goreleaser.yml
!.gitleaks.toml
!.yamllint
!.golangci.toml
!Dockerfile
!CODEOWNERS
!README.md
!LICENSE
!renovate.json

# ...even if they are in subdirectories
!*/
9 changes: 9 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title = "Gitleaks Configuration"

[extend]
useDefault = true
[allowlist]
description = "global allow list"
paths = [
'''README.md''','''.idea''','''.vscode'''
]
12 changes: 12 additions & 0 deletions .golangci.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[run]
timeout = "120s"

[output]
format = "colored-line-number"

[linters]
enable = [
"gocyclo", "unconvert", "goimports","vetshadow", "misspell", "ineffassign","goconst", "vet", "unparam", "gofmt"]

[issues]
exclude-use-default = false
101 changes: 101 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
archives:
- id: archive
name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
builds:
- binary: external-dns-infoblox-webhook
env:
- CGO_ENABLED=0
- GO111MODULE=on
goarch:
- amd64
- arm64
goos:
- darwin
- 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/bison-cloud-platform/external-dns-infoblox-webhook:latest-amd64
- ghcr.io/bison-cloud-platform/external-dns-infoblox-webhook:{{ .Env.CI_COMMIT_SHA }}-amd64
- ghcr.io/bison-cloud-platform/external-dns-infoblox-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/bison-cloud-platform/external-dns-infoblox-webhook:latest-arm64
- ghcr.io/bison-cloud-platform/external-dns-infoblox-webhook:{{ .Env.CI_COMMIT_SHA }}-arm64
- ghcr.io/bison-cloud-platform/external-dns-infoblox-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 }}"
docker_manifests:
- name_template: ghcr.io/bison-cloud-platform/external-dns-infoblox-webhook:latest
image_templates:
- ghcr.io/bison-cloud-platform/external-dns-infoblox-webhook:latest-amd64
- ghcr.io/bison-cloud-platform/external-dns-infoblox-webhook:latest-arm64
- name_template: ghcr.io/bison-cloud-platform/external-dns-infoblox-webhook:{{ .Env.CI_COMMIT_SHA }}
image_templates:
- ghcr.io/bison-cloud-platform/external-dns-infoblox-webhook:{{ .Env.CI_COMMIT_SHA }}-amd64
- ghcr.io/bison-cloud-platform/external-dns-infoblox-webhook:{{ .Env.CI_COMMIT_SHA }}-arm64
- name_template: ghcr.io/bison-cloud-platform/external-dns-infoblox-webhook:{{ .Env.CI_COMMIT_TAG }}
image_templates:
- ghcr.io/bison-cloud-platform/external-dns-infoblox-webhook:{{ .Env.CI_COMMIT_TAG }}-amd64
- ghcr.io/bison-cloud-platform/external-dns-infoblox-webhook:{{ .Env.CI_COMMIT_TAG }}-arm64
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"
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.0"
}
34 changes: 34 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
yaml-files:
- '*.yaml'
- '.yamllint'

rules:
braces:
level: warning
max-spaces-inside: 1
brackets: enable
colons: enable
commas: enable
comments:
level: warning
comments-indentation:
level: warning
document-end: disable
document-start: disable
empty-lines: enable
empty-values: disable
hyphens: enable
indentation: disable
key-duplicates: enable
key-ordering: disable
line-length: disable
new-line-at-end-of-file: enable
new-lines: enable
octal-values: disable
quoted-strings: disable
trailing-spaces: enable
truthy: disable

ignore:
"**/templates/*.yaml"
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-infoblox-webhook /opt/external-dns-infoblox-webhook/app

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

0 comments on commit 7fc064c

Please sign in to comment.