-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating a Golang version of reckoner
- Loading branch information
Andrew Suderman
committed
Mar 17, 2021
1 parent
57ff2b4
commit 53ebe15
Showing
29 changed files
with
2,670 additions
and
142 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,6 @@ htmlcov/ | |
build/ | ||
reckoner/version.txt | ||
installer/reckoner.spec | ||
/bin | ||
|
||
coverage.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
builds: | ||
- ldflags: | ||
- -X main.version={{.Version}} -X main.commit={{.Commit}} -s -w | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
goarm: | ||
- 6 | ||
- 7 | ||
dockers: | ||
- image_templates: | ||
- "quay.io/fairwinds/reckoner:{{ .Tag }}-amd64" | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}-amd64" | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}.{{ .Minor }}-amd64" | ||
use_buildx: true | ||
dockerfile: Dockerfile | ||
build_flag_templates: | ||
- "--platform=linux/amd64" | ||
- image_templates: | ||
- "quay.io/fairwinds/reckoner:{{ .Tag }}-arm64v8" | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}-arm64v8" | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}.{{ .Minor }}-arm64v8" | ||
use_buildx: true | ||
goarch: arm64 | ||
dockerfile: Dockerfile | ||
build_flag_templates: | ||
- "--platform=linux/arm64/v8" | ||
- image_templates: | ||
- "quay.io/fairwinds/reckoner:{{ .Tag }}-armv7" | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}-armv7" | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}.{{ .Minor }}-armv7" | ||
use_buildx: true | ||
goarch: arm64 | ||
dockerfile: Dockerfile | ||
build_flag_templates: | ||
- "--platform=linux/arm/v7" | ||
docker_manifests: | ||
- name_template: quay.io/fairwinds/reckoner:{{ .Tag }} | ||
image_templates: | ||
- "quay.io/fairwinds/reckoner:{{ .Tag }}-amd64" | ||
- "quay.io/fairwinds/reckoner:{{ .Tag }}-arm64v8" | ||
- "quay.io/fairwinds/reckoner:{{ .Tag }}-armv7" | ||
- name_template: quay.io/fairwinds/reckoner:v{{ .Major }} | ||
image_templates: | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}-amd64" | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}-arm64v8" | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}-armv7" | ||
- name_template: quay.io/fairwinds/reckoner:v{{ .Major }}.{{ .Minor }} | ||
image_templates: | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}.{{ .Minor }}-amd64" | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}.{{ .Minor }}-arm64v8" | ||
- "quay.io/fairwinds/reckoner:v{{ .Major }}.{{ .Minor }}-armv7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.3.0 | ||
hooks: | ||
- id: check-json | ||
- id: detect-private-key | ||
- id: trailing-whitespace | ||
exclude: > | ||
(?x)^( | ||
docs/.+ | ||
)$ | ||
- id: check-added-large-files | ||
args: ['--maxkb=500'] | ||
- id: check-byte-order-marker | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: end-of-file-fixer | ||
exclude: > | ||
(?x)^( | ||
docs/.+ | ||
)$ | ||
- id: check-executables-have-shebangs | ||
- id: flake8 | ||
- id: no-commit-to-branch | ||
args: [--branch, master] | ||
- id: pretty-format-json | ||
args: ['--autofix'] | ||
- repo: https://github.com/jumanjihouse/pre-commit-hooks | ||
rev: 2.1.5 | ||
hooks: | ||
- id: forbid-binary | ||
exclude: > | ||
(?x)^( | ||
.+\.png| | ||
.+\.woff| | ||
.+\.woff2| | ||
.+\.tff| | ||
.+\.ico | ||
)$ | ||
- id: shellcheck | ||
- repo: https://github.com/dnephin/pre-commit-golang.git | ||
rev: v0.3.5 | ||
hooks: | ||
- id: go-fmt | ||
- id: golangci-lint | ||
- id: go-vet | ||
- id: go-unit-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Go parameters | ||
GOCMD=GO111MODULE=on go | ||
GOBUILD=$(GOCMD) build | ||
GOCLEAN=$(GOCMD) clean | ||
GOTEST=$(GOCMD) test | ||
BINARY_NAME=bin/reckoner | ||
COMMIT := $(shell git rev-parse HEAD) | ||
VERSION := "0.0.0" | ||
|
||
all: lint test | ||
build: | ||
$(GOBUILD) -o $(BINARY_NAME) -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT) -s -w" -v | ||
lint: | ||
golangci-lint run | ||
reportcard: | ||
goreportcard-cli -t 100 -v | ||
test: | ||
GO111MODULE=on $(GOCMD) test -v --bench --benchmem -coverprofile coverage.txt -covermode=atomic ./... | ||
GO111MODULE=on $(GOCMD) vet ./... 2> govet-report.out | ||
GO111MODULE=on $(GOCMD) tool cover -html=coverage.txt -o cover-report.html | ||
printf "\nCoverage report available at cover-report.html\n\n" | ||
tidy: | ||
$(GOCMD) mod tidy | ||
clean: | ||
$(GOCLEAN) | ||
$(GOCMD) fmt ./... | ||
rm -f $(BINARY_NAME) | ||
# Cross compilation | ||
build-linux: | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME) -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT) -s -w" -v | ||
build-docker: | ||
docker build --build-arg version=$(VERSION) --build-arg commit=$(COMMIT) -t quay.io/reactiveops/$(BINARY_NAME):dev . |
Oops, something went wrong.