-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e9de62e
Showing
11 changed files
with
845 additions
and
0 deletions.
There are no files selected for viewing
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,33 @@ | ||
name: Generate release-artifacts | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
env: | ||
DOCKER_CLI_EXPERIMENTAL: "enabled" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18.2 | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
version: latest | ||
args: release --rm-dist --debug | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,38 @@ | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
test/dist | ||
build | ||
|
||
.vscode/ | ||
|
||
bin/* | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
run: | ||
timeout: 5m | ||
modules-download-mode: readonly | ||
|
||
linters: | ||
disable: | ||
- golint | ||
- typecheck | ||
- structcheck | ||
enable: | ||
- errcheck | ||
- goimports | ||
- gocritic | ||
- govet | ||
- staticcheck | ||
|
||
issues: | ||
exclude-use-default: false | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 |
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,38 @@ | ||
# This is an example .goreleaser.yml file with some sensible defaults. | ||
# Make sure to check the documentation at https://goreleaser.com | ||
dist: build | ||
before: | ||
hooks: | ||
# You may remove this if you don't use go modules. | ||
- go mod tidy | ||
# you may remove this if you don't need go generate | ||
- go generate ./... | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
|
||
archives: | ||
- replacements: | ||
darwin: darwin | ||
linux: linux | ||
windows: windows | ||
386: i386 | ||
amd64: amd64 | ||
checksum: | ||
name_template: 'checksums.txt' | ||
algorithm: sha256 | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
- '^vendor:' |
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,88 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.2.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: destroyed-symlinks | ||
- id: detect-private-key | ||
- id: check-ast | ||
- id: check-case-conflict | ||
- id: debug-statements | ||
- repo: https://github.com/Yelp/detect-secrets | ||
rev: v1.2.0 | ||
hooks: | ||
- id: detect-secrets | ||
- repo: https://github.com/tekwizely/pre-commit-golang | ||
rev: v1.0.0-beta.5 | ||
hooks: | ||
# | ||
# Go Build | ||
# | ||
- id: go-build-mod | ||
- id: go-build-pkg | ||
# | ||
# Go Mod Tidy | ||
# | ||
- id: go-mod-tidy | ||
# | ||
# Go Test | ||
# | ||
- id: go-test-mod | ||
# - id: go-test-pkg | ||
# | ||
# Go Vet | ||
# | ||
# - id: go-vet | ||
# - id: go-vet-mod | ||
# - id: go-vet-pkg | ||
# | ||
# Revive | ||
# | ||
- id: go-revive | ||
# | ||
# GoSec | ||
# | ||
- id: go-sec-mod | ||
#- id: go-sec-pkg | ||
# | ||
# StaticCheck | ||
# | ||
# - id: go-staticcheck-mod | ||
# - id: go-staticcheck-pkg | ||
# - id: go-staticcheck-repo-mod | ||
# - id: go-staticcheck-repo-pkg | ||
# | ||
# StructSlop | ||
# | ||
# - id: go-structslop-mod | ||
# - id: go-structslop-pkg | ||
# - id: go-structslop-repo-mod | ||
# - id: go-structslop-repo-pkg | ||
# | ||
# Formatters | ||
# | ||
# - id: go-fmt | ||
# args: [ -s, -w ] | ||
# - id: go-fmt-repo | ||
# - id: go-fumpt # replaces go-fmt | ||
# - id: go-fumpt-repo # replaces go-fmt-repo | ||
# - id: go-imports # replaces go-fmt | ||
# - id: go-imports-repo # replaces go-fmt-repo | ||
# - id: go-returns # replaces go-imports & go-fmt | ||
# - id: go-returns-repo # replaces go-imports-repo & go-fmt-repo | ||
# | ||
# Style Checkers | ||
# | ||
- id: go-lint | ||
# - id: go-critic | ||
# | ||
# GolangCI-Lint | ||
# - Fast Multi-Linter | ||
# - Can be configured to replace MOST other hooks | ||
# - Supports repo config file for configuration | ||
# - https://github.com/golangci/golangci-lint | ||
# | ||
# - id: golangci-lint |
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,31 @@ | ||
.PHONY: build install clean test integration modverify modtidy | ||
|
||
VERSION=`egrep -o '[0-9]+\.[0-9a-z.\-]+' version.go` | ||
GIT_SHA=`git rev-parse --short HEAD || echo` | ||
|
||
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*") | ||
|
||
build: | ||
@echo "Building definition_exporter..." | ||
@mkdir -p bin | ||
@go build -ldflags "-X cmd.GitSHA=${GIT_SHA}" -o bin/definition_exporter . | ||
|
||
install: | ||
@echo "Installing definition_exporter..." | ||
@install -c bin/definition_exporter /usr/local/bin/definition_exporter | ||
|
||
clean: | ||
@rm -f bin/* | ||
|
||
test: | ||
@echo "Running tests..." | ||
#@go test `go list ./... | grep -v vendor/` | ||
|
||
fmt: | ||
@gofmt -l -w -s $(SRC) | ||
|
||
modtidy: | ||
@go mod tidy | ||
|
||
modverify: | ||
@go mod verify |
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 @@ | ||
# Devops.Infra.client-definition-exporter |
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,9 @@ | ||
package main | ||
|
||
// Ops represents the commandline/environment options for the program | ||
type ConfigOpts struct { | ||
BaseDir string `long:"basedir" short:"d" env:"BASEDIR" default:"/srv/www/" description:"Definition location"` | ||
MetricsBindAddr string `long:"metrics-bind-address" short:"b" env:"METRICS_BIND_ADDRESS" default:"9115" description:"Address for binding metrics listener"` | ||
MetricsPath string `long:"metrics-path" env:"METRICS_PATH" default:"/metrics" description:"Metrics path"` | ||
Refresh int `long:"refresh" short:"r" env:"REFRESH" default:"60" description:"Definition refresh rate"` | ||
} |
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,23 @@ | ||
module github.com/pxfd/definition-exporter | ||
|
||
go 1.18 | ||
|
||
require ( | ||
github.com/jessevdk/go-flags v1.5.0 | ||
github.com/prometheus/client_golang v1.14.0 | ||
k8s.io/klog/v2 v2.80.1 | ||
) | ||
|
||
require ( | ||
github.com/beorn7/perks v1.0.1 // indirect | ||
github.com/cespare/xxhash/v2 v2.1.2 // indirect | ||
github.com/go-logr/logr v1.2.3 // indirect | ||
github.com/golang/protobuf v1.5.2 // indirect | ||
github.com/google/go-cmp v0.5.9 // indirect | ||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect | ||
github.com/prometheus/client_model v0.3.0 // indirect | ||
github.com/prometheus/common v0.37.0 // indirect | ||
github.com/prometheus/procfs v0.8.0 // indirect | ||
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect | ||
google.golang.org/protobuf v1.28.1 // indirect | ||
) |
Oops, something went wrong.