Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckal777 committed Mar 14, 2024
0 parents commit ce2629b
Show file tree
Hide file tree
Showing 21 changed files with 3,135 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
################################################################################
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
# Edit Makefile.maker.yaml instead. #
################################################################################

name: Checks
"on":
push:
branches:
- master
pull_request:
branches:
- '*'
permissions:
checks: write
contents: read
jobs:
checks:
name: Checks
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
check-latest: true
go-version: "1.22"
- name: Dependency Licenses Review
run: make check-dependency-licenses
- name: Run govulncheck
uses: golang/govulncheck-action@v1
- name: Check for spelling errors
uses: reviewdog/action-misspell@v1
with:
exclude: ./vendor/*
fail_on_error: true
github_token: ${{ secrets.GITHUB_TOKEN }}
ignore: importas
reporter: github-check
- name: Check if source code files have license header
run: make check-license-headers
39 changes: 39 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
################################################################################
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
# Edit Makefile.maker.yaml instead. #
################################################################################

name: CodeQL
"on":
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '00 07 * * 1'
permissions:
actions: read
contents: read
security-events: write
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
check-latest: true
go-version: "1.22"
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
42 changes: 42 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and run tests
on: [push, pull_request]
env:
GOTOOLCHAIN: local

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
check-latest: true

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# always uses the latest patch version.
version: v1.55
args: "--timeout 5m"

test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
check-latest: true

- name: Install Ginkgo CLI
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.16.0

- name: Run tests
run: make build/cover.out
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
maintenance-controller
bin/
testbin/
build/

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# IDEs
.vscode
.DS_store
65 changes: 65 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
linters:
enable:
- gosec
- unconvert
- goconst
- gocyclo
- asciicheck
- misspell
- lll
- unparam
- dogsled
- nakedret
- prealloc
- gocritic
- godox
- funlen
- whitespace
- gomnd
- godot
- nestif
- nolintlint
- bodyclose
- cyclop
- dogsled
- durationcheck
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- importas
- makezero
- nilerr
- noctx
- predeclared
- tagliatelle
- revive
- ifshort
- asasalint
- decorder
- errchkjson
- errname
- execinquery
- grouper
- maintidx
- nilnil
- nonamedreturns
- nosprintfhostport
- tenv
- usestdlibvars
disable-all: false
fast: false
linters-settings:
revive:
rules:
- name: unused-parameter
disabled: true
issues:
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- forcetypeassert
- linters:
- lll
source: "^//.*https://.*" # Exclude links from line length check
4 changes: 4 additions & 0 deletions .license-scan-overrides.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{"name": "github.com/chzyer/logex", "licenceType": "MIT"}
{"name": "github.com/hashicorp/vault/api/auth/approle", "licenceType": "MPL-2.0"}
{"name": "github.com/jpillora/longestcommon", "licenceType": "MIT"}
{"name": "github.com/spdx/tools-golang", "licenceTextOverrideFile": "vendor/github.com/spdx/tools-golang/LICENSE.code"}
11 changes: 11 additions & 0 deletions .license-scan-rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"allowlist": [
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"ISC",
"MIT",
"MPL-2.0",
"Unlicense"
]
}
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Build the manager binary
FROM golang:1.22-alpine as builder

WORKDIR /workspace
ENV GOTOOLCHAIN=local
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

COPY ./ /workspace/
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags="-s -w" -a -o runtime-extension-maintenance-controller main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
LABEL source_repository="https://github.com/sapcc/runtime-extension-maintenance-controller"
COPY --from=builder /workspace/runtime-extension-maintenance-controller .
USER nonroot:nonroot

ENTRYPOINT ["/runtime-extension-maintenance-controller"]
Loading

0 comments on commit ce2629b

Please sign in to comment.