You've already forked getidev
Compare commits
40 Commits
v0.1.0
...
1181a47282
Author | SHA1 | Date | |
---|---|---|---|
1181a47282
|
|||
c7d8002cd2
|
|||
26e4986b7e
|
|||
375c92edaf
|
|||
13e5e1ea44
|
|||
4703b28598 | |||
f051599271
|
|||
cd19620846
|
|||
56cf4af6c7 | |||
3254b5a722
|
|||
726ff9e6c7
|
|||
806a19f79e
|
|||
26533455cc
|
|||
52dd8914a0
|
|||
45e9282ccd
|
|||
cae06acb21
|
|||
e75a7f7c4b
|
|||
5a726d96c5
|
|||
2e0746494a
|
|||
765d447746
|
|||
7fd6def709
|
|||
0281bcb254
|
|||
bd8c66cf21
|
|||
77732323ba
|
|||
5b27b63a49
|
|||
4cdb5bac39
|
|||
d2ff11f94f
|
|||
aed2e41d07
|
|||
9d1e9a3618
|
|||
ff53647c83
|
|||
8c9016fa8c
|
|||
c80e1bfc52 | |||
8d5776387d
|
|||
e952b29d5a | |||
d8e74f4605
|
|||
8538cedbfd
|
|||
e3962a74db
|
|||
a25ad8d302
|
|||
ba74445c54
|
|||
0298a6a2bf
|
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
getidev
|
@ -1,15 +1,13 @@
|
|||||||
# EditorConfig is awesome: https://EditorConfig.org
|
# Editor configuration, see http://editorconfig.org
|
||||||
|
|
||||||
# top-most EditorConfig file
|
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
end_of_line = lf
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
insert_final_newline = false
|
insert_final_newline = false
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
[Makefile]
|
[{Makefile,*.go}]
|
||||||
indent_style = tab
|
indent_style = tab
|
29
.gitea/workflows/golang-linters.yaml
Normal file
29
.gitea/workflows/golang-linters.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
name: "Lint Golang files"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [ "opened", "reopened", "synchronize" ]
|
||||||
|
push:
|
||||||
|
branches: [ '**' ]
|
||||||
|
tags-ignore: [ '**' ]
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
golangci:
|
||||||
|
name: "Run golang CI linter"
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go: [ stable ]
|
||||||
|
os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4.3.0
|
||||||
|
- uses: actions/setup-go@v5.5.0
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go }}
|
||||||
|
- uses: golangci/golangci-lint-action@v8.0.0
|
||||||
|
with:
|
||||||
|
v2.3.1 # renovate: datasource=github-releases depName=golangci/golangci-lint
|
42
.gitea/workflows/golang-tests.yaml
Normal file
42
.gitea/workflows/golang-tests.yaml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: "Run Golang tests"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [ "opened", "reopened", "synchronize" ]
|
||||||
|
push:
|
||||||
|
branches: [ '**' ]
|
||||||
|
tags-ignore: [ '**' ]
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# integration-test:
|
||||||
|
# name: "Run integration tests"
|
||||||
|
# runs-on: ${{ matrix.os }}
|
||||||
|
# strategy:
|
||||||
|
# matrix:
|
||||||
|
# go: [ stable ]
|
||||||
|
# os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4.3.0
|
||||||
|
# - uses: actions/setup-go@v5.5.0
|
||||||
|
# with:
|
||||||
|
# go-version: ${{ matrix.go }}
|
||||||
|
# - env:
|
||||||
|
# GOPROXY: ${{ vars.GOPROXY }}
|
||||||
|
# run: make test/integration
|
||||||
|
|
||||||
|
unit-test:
|
||||||
|
name: "Run unit tests"
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go: [ stable ]
|
||||||
|
os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4.3.0
|
||||||
|
- uses: actions/setup-go@v5.5.0
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go }}
|
||||||
|
- env:
|
||||||
|
GOPROXY: ${{ vars.GOPROXY }}
|
||||||
|
run: make test/unit
|
19
.gitea/workflows/markdown-linters.yaml
Normal file
19
.gitea/workflows/markdown-linters.yaml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
name: "Lint Markdown files"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [ "opened", "reopened", "synchronize" ]
|
||||||
|
push:
|
||||||
|
branches: [ '*' ]
|
||||||
|
tags-ignore: [ '*' ]
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
markdown-lint:
|
||||||
|
name: "Run markdown linter"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4.3.0
|
||||||
|
- uses: DavidAnson/markdownlint-cli2-action@v20.0.0
|
||||||
|
with:
|
||||||
|
globs: '**/*.md'
|
52
.gitea/workflows/release.yaml
Normal file
52
.gitea/workflows/release.yaml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
name: "Release"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: [ '**' ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: "Release application"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4.3.0
|
||||||
|
- uses: docker/setup-qemu-action@v3.6.0
|
||||||
|
- uses: actions/setup-go@v5.5.0
|
||||||
|
with:
|
||||||
|
go-version: stable
|
||||||
|
- uses: docker/login-action@v3.5.0
|
||||||
|
with:
|
||||||
|
registry: git.cryptic.systems
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }}
|
||||||
|
- env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }}
|
||||||
|
GONOSUMDB: ${{ vars.GONOSUMDB }}
|
||||||
|
GOPROXY: ${{ vars.GOPROXY }}
|
||||||
|
uses: goreleaser/goreleaser-action@v6.3.0
|
||||||
|
with:
|
||||||
|
version: v2.11.2 # renovate: datasource=github-releases depName=goreleaser/goreleaser
|
||||||
|
args: release --clean
|
||||||
|
# sync-to-hub-docker-io:
|
||||||
|
# name: "Upload Images to docker.io"
|
||||||
|
# needs:
|
||||||
|
# - release
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - name: Copy images to docker.io
|
||||||
|
# run: |
|
||||||
|
# TAG=$(echo ${{ github.ref_name }} | sed 's/v//gm')
|
||||||
|
|
||||||
|
# apt-get update --yes
|
||||||
|
# apt-get install --yes skopeo
|
||||||
|
# skopeo copy \
|
||||||
|
# --all \
|
||||||
|
# --dest-password ${{ secrets.DOCKER_IO_PASSWORD }} \
|
||||||
|
# --dest-username ${{ secrets.DOCKER_IO_USERNAME }} \
|
||||||
|
# --src-password ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }} \
|
||||||
|
# --src-username volker.raschek \
|
||||||
|
# docker://git.cryptic.systems/volker.raschek/getidev:${TAG} \
|
||||||
|
# docker://docker.io/volkerraschek/getidev:${TAG}
|
19
.gitea/workflows/update-docker-hub-description.yaml
Normal file
19
.gitea/workflows/update-docker-hub-description.yaml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# name: "Update Docker Hub Description"
|
||||||
|
|
||||||
|
# on:
|
||||||
|
# push:
|
||||||
|
# branches: [ 'master' ]
|
||||||
|
# paths: [ 'README.md' ]
|
||||||
|
# workflow_dispatch: {}
|
||||||
|
|
||||||
|
# jobs:
|
||||||
|
# update-description-on-hub-docker-io:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4.3.0
|
||||||
|
# - uses: peter-evans/dockerhub-description@v4.0.2
|
||||||
|
# with:
|
||||||
|
# username: ${{ secrets.DOCKER_IO_USERNAME }}
|
||||||
|
# password: ${{ secrets.DOCKER_IO_PASSWORD }}
|
||||||
|
# repository: volkerraschek/getidev
|
||||||
|
# readme-filepath: README.md
|
26
.gitignore
vendored
26
.gitignore
vendored
@ -1 +1,25 @@
|
|||||||
getidev
|
**/*.iml
|
||||||
|
**/*.idea
|
||||||
|
**/target
|
||||||
|
**/.project
|
||||||
|
**/.settings
|
||||||
|
**/.classpath
|
||||||
|
**/npm-debug.log
|
||||||
|
**/node/*
|
||||||
|
**/nb-configuration.xml
|
||||||
|
**/*.war
|
||||||
|
**/*.class
|
||||||
|
**/*.DS_Store
|
||||||
|
|
||||||
|
**/.vscode
|
||||||
|
|
||||||
|
.repo
|
||||||
|
**/pom.xml.releaseBackup
|
||||||
|
**/release.properties
|
||||||
|
**/bindata.go
|
||||||
|
**/t1k.rpm
|
||||||
|
**/orbis-u-t1k.tar.gz
|
||||||
|
**/container.log
|
||||||
|
**/.env
|
||||||
|
**/coverage*
|
||||||
|
getidev*
|
13
.golangci.yaml
Normal file
13
.golangci.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
version: "2"
|
||||||
|
linters:
|
||||||
|
default: standard
|
||||||
|
enable:
|
||||||
|
- errname
|
||||||
|
- gosec
|
||||||
|
|
||||||
|
exclusions:
|
||||||
|
rules: []
|
||||||
|
warn-unused: true
|
||||||
|
|
||||||
|
run:
|
||||||
|
tests: true
|
@ -1,29 +0,0 @@
|
|||||||
run:
|
|
||||||
skip-dirs:
|
|
||||||
- it
|
|
||||||
timeout: 10m
|
|
||||||
tests: true
|
|
||||||
|
|
||||||
linters:
|
|
||||||
disable-all: true
|
|
||||||
enable:
|
|
||||||
# Default
|
|
||||||
- deadcode
|
|
||||||
- errcheck
|
|
||||||
- gosimple
|
|
||||||
- govet
|
|
||||||
- ineffassign
|
|
||||||
- staticcheck
|
|
||||||
- structcheck
|
|
||||||
- typecheck
|
|
||||||
- unused
|
|
||||||
- varcheck
|
|
||||||
|
|
||||||
# Additionally linters
|
|
||||||
- bodyclose
|
|
||||||
- misspell
|
|
||||||
- nilerr
|
|
||||||
- rowserrcheck
|
|
||||||
- sqlclosecheck
|
|
||||||
- unparam
|
|
||||||
- whitespace
|
|
175
.goreleaser.yaml
Normal file
175
.goreleaser.yaml
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
project_name: getidev
|
||||||
|
|
||||||
|
archives:
|
||||||
|
- formats: [ "tar.xz" ]
|
||||||
|
files:
|
||||||
|
- README.md
|
||||||
|
- LICENSE
|
||||||
|
|
||||||
|
before:
|
||||||
|
hooks:
|
||||||
|
- go mod tidy
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- main: main.go
|
||||||
|
binary: >-
|
||||||
|
{{ .ProjectName }}-
|
||||||
|
{{- .Version }}-
|
||||||
|
{{- .Os }}-
|
||||||
|
{{- if eq .Arch "amd64" }}amd64
|
||||||
|
{{- else if eq .Arch "amd64_v1" }}amd64
|
||||||
|
{{- else }}{{ .Arch }}{{ end }}
|
||||||
|
{{- if .Arm }}-{{ .Arm }}{{ end }}
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
- GONOSUMDB={{ .Env.GONOSUMDB }}
|
||||||
|
- GOPROXY={{ .Env.GOPROXY }}
|
||||||
|
goos:
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm
|
||||||
|
- arm64
|
||||||
|
- riscv64
|
||||||
|
goarm:
|
||||||
|
- "6"
|
||||||
|
- "7"
|
||||||
|
flags:
|
||||||
|
- -trimpath
|
||||||
|
ldflags:
|
||||||
|
- -s -w -X 'main.version={{ trimprefix .Tag "v" }}'
|
||||||
|
|
||||||
|
changelog:
|
||||||
|
filters:
|
||||||
|
exclude:
|
||||||
|
- '^chore'
|
||||||
|
- '^docs'
|
||||||
|
- '^test'
|
||||||
|
- Merge pull request
|
||||||
|
- Merge branch
|
||||||
|
- go mod tidy
|
||||||
|
format: "{{.SHA}}: {{.Message}} (@{{.AuthorUsername}})"
|
||||||
|
groups:
|
||||||
|
- title: Features
|
||||||
|
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
|
||||||
|
order: 0
|
||||||
|
- title: "Bug fixes"
|
||||||
|
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
|
||||||
|
order: 1
|
||||||
|
- title: Others
|
||||||
|
order: 999
|
||||||
|
sort: asc
|
||||||
|
use: git
|
||||||
|
|
||||||
|
dockers:
|
||||||
|
- build_flag_templates:
|
||||||
|
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
|
||||||
|
- --label=org.opencontainers.image.description={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.documentation={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
||||||
|
- --label=org.opencontainers.image.source={{ .GitURL }}
|
||||||
|
- --label=org.opencontainers.image.title={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.url=https://git.cryptic.systems/volker.raschek/{{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.version={{ trimprefix .Tag "v" }}
|
||||||
|
- --platform=linux/amd64
|
||||||
|
- --pull
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
goarch: amd64
|
||||||
|
goos: linux
|
||||||
|
image_templates:
|
||||||
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-amd64'
|
||||||
|
skip_push: false
|
||||||
|
use: buildx
|
||||||
|
|
||||||
|
- build_flag_templates:
|
||||||
|
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
|
||||||
|
- --label=org.opencontainers.image.description={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.documentation={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
||||||
|
- --label=org.opencontainers.image.source={{ .GitURL }}
|
||||||
|
- --label=org.opencontainers.image.title={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.url=https://git.cryptic.systems/volker.raschek/{{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.version={{ trimprefix .Tag "v" }}
|
||||||
|
- --platform=linux/arm/v6
|
||||||
|
- --pull
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
goarch: arm
|
||||||
|
goarm: "6"
|
||||||
|
goos: linux
|
||||||
|
image_templates:
|
||||||
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v6'
|
||||||
|
skip_push: false
|
||||||
|
use: buildx
|
||||||
|
|
||||||
|
- build_flag_templates:
|
||||||
|
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
|
||||||
|
- --label=org.opencontainers.image.description={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.documentation={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
||||||
|
- --label=org.opencontainers.image.source={{ .GitURL }}
|
||||||
|
- --label=org.opencontainers.image.title={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.url=https://git.cryptic.systems/volker.raschek/{{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.version={{ trimprefix .Tag "v" }}
|
||||||
|
- --platform=linux/arm/v7
|
||||||
|
- --pull
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
goarch: arm
|
||||||
|
goarm: "7"
|
||||||
|
goos: linux
|
||||||
|
image_templates:
|
||||||
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v7'
|
||||||
|
skip_push: false
|
||||||
|
use: buildx
|
||||||
|
|
||||||
|
- build_flag_templates:
|
||||||
|
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
|
||||||
|
- --label=org.opencontainers.image.description={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.documentation={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
||||||
|
- --label=org.opencontainers.image.source={{ .GitURL }}
|
||||||
|
- --label=org.opencontainers.image.title={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.url=https://git.cryptic.systems/volker.raschek/{{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.version={{ trimprefix .Tag "v" }}
|
||||||
|
- --platform=linux/arm64
|
||||||
|
- --pull
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
goarch: arm64
|
||||||
|
goos: linux
|
||||||
|
image_templates:
|
||||||
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm64'
|
||||||
|
skip_push: false
|
||||||
|
use: buildx
|
||||||
|
|
||||||
|
- build_flag_templates:
|
||||||
|
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
|
||||||
|
- --label=org.opencontainers.image.description={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.documentation={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
||||||
|
- --label=org.opencontainers.image.source={{ .GitURL }}
|
||||||
|
- --label=org.opencontainers.image.title={{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.url=https://git.cryptic.systems/volker.raschek/{{ .ProjectName }}
|
||||||
|
- --label=org.opencontainers.image.version={{ trimprefix .Tag "v" }}
|
||||||
|
- --platform=linux/riscv64
|
||||||
|
- --pull
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
goarch: riscv64
|
||||||
|
goos: linux
|
||||||
|
image_templates:
|
||||||
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-riscv64'
|
||||||
|
skip_push: false
|
||||||
|
use: buildx
|
||||||
|
|
||||||
|
docker_manifests:
|
||||||
|
- name_template: 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}'
|
||||||
|
image_templates:
|
||||||
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-amd64'
|
||||||
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v6'
|
||||||
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v7'
|
||||||
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm64'
|
||||||
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-riscv64'
|
||||||
|
|
||||||
|
gitea_urls:
|
||||||
|
api: https://git.cryptic.systems/api/v1
|
||||||
|
download: https://git.cryptic.systems
|
||||||
|
|
||||||
|
version: 2
|
136
.markdownlint.yaml
Normal file
136
.markdownlint.yaml
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
# markdownlint YAML configuration
|
||||||
|
# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
|
||||||
|
|
||||||
|
# Default state for all rules
|
||||||
|
default: true
|
||||||
|
|
||||||
|
# Path to configuration file to extend
|
||||||
|
extends: null
|
||||||
|
|
||||||
|
# MD003/heading-style/header-style - Heading style
|
||||||
|
MD003:
|
||||||
|
# Heading style
|
||||||
|
style: "atx"
|
||||||
|
|
||||||
|
# MD004/ul-style - Unordered list style
|
||||||
|
MD004:
|
||||||
|
style: "dash"
|
||||||
|
|
||||||
|
# MD007/ul-indent - Unordered list indentation
|
||||||
|
MD007:
|
||||||
|
# Spaces for indent
|
||||||
|
indent: 2
|
||||||
|
# Whether to indent the first level of the list
|
||||||
|
start_indented: false
|
||||||
|
|
||||||
|
# MD009/no-trailing-spaces - Trailing spaces
|
||||||
|
MD009:
|
||||||
|
# Spaces for line break
|
||||||
|
br_spaces: 2
|
||||||
|
# Allow spaces for empty lines in list items
|
||||||
|
list_item_empty_lines: false
|
||||||
|
# Include unnecessary breaks
|
||||||
|
strict: false
|
||||||
|
|
||||||
|
# MD010/no-hard-tabs - Hard tabs
|
||||||
|
MD010:
|
||||||
|
# Include code blocks
|
||||||
|
code_blocks: true
|
||||||
|
|
||||||
|
# MD012/no-multiple-blanks - Multiple consecutive blank lines
|
||||||
|
MD012:
|
||||||
|
# Consecutive blank lines
|
||||||
|
maximum: 1
|
||||||
|
|
||||||
|
# MD013/line-length - Line length
|
||||||
|
MD013:
|
||||||
|
# Number of characters
|
||||||
|
line_length: 120
|
||||||
|
# Number of characters for headings
|
||||||
|
heading_line_length: 120
|
||||||
|
# Number of characters for code blocks
|
||||||
|
code_block_line_length: 120
|
||||||
|
# Include code blocks
|
||||||
|
code_blocks: false
|
||||||
|
# Include tables
|
||||||
|
tables: false
|
||||||
|
# Include headings
|
||||||
|
headings: true
|
||||||
|
# Strict length checking
|
||||||
|
strict: false
|
||||||
|
# Stern length checking
|
||||||
|
stern: false
|
||||||
|
|
||||||
|
# MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines
|
||||||
|
MD022:
|
||||||
|
# Blank lines above heading
|
||||||
|
lines_above: 1
|
||||||
|
# Blank lines below heading
|
||||||
|
lines_below: 1
|
||||||
|
|
||||||
|
# MD025/single-title/single-h1 - Multiple top-level headings in the same document
|
||||||
|
MD025:
|
||||||
|
# Heading level
|
||||||
|
level: 1
|
||||||
|
# RegExp for matching title in front matter
|
||||||
|
front_matter_title: "^\\s*title\\s*[:=]"
|
||||||
|
|
||||||
|
# MD026/no-trailing-punctuation - Trailing punctuation in heading
|
||||||
|
MD026:
|
||||||
|
# Punctuation characters
|
||||||
|
punctuation: ".,;:!。,;:!"
|
||||||
|
|
||||||
|
# MD029/ol-prefix - Ordered list item prefix
|
||||||
|
MD029:
|
||||||
|
# List style
|
||||||
|
style: "one_or_ordered"
|
||||||
|
|
||||||
|
# MD030/list-marker-space - Spaces after list markers
|
||||||
|
MD030:
|
||||||
|
# Spaces for single-line unordered list items
|
||||||
|
ul_single: 1
|
||||||
|
# Spaces for single-line ordered list items
|
||||||
|
ol_single: 1
|
||||||
|
# Spaces for multi-line unordered list items
|
||||||
|
ul_multi: 1
|
||||||
|
# Spaces for multi-line ordered list items
|
||||||
|
ol_multi: 1
|
||||||
|
|
||||||
|
# MD033/no-inline-html - Inline HTML
|
||||||
|
MD033:
|
||||||
|
# Allowed elements
|
||||||
|
allowed_elements: []
|
||||||
|
|
||||||
|
# MD035/hr-style - Horizontal rule style
|
||||||
|
MD035:
|
||||||
|
# Horizontal rule style
|
||||||
|
style: "---"
|
||||||
|
|
||||||
|
# MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading
|
||||||
|
MD036:
|
||||||
|
# Punctuation characters
|
||||||
|
punctuation: ".,;:!?。,;:!?"
|
||||||
|
|
||||||
|
# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
|
||||||
|
MD041:
|
||||||
|
# Heading level
|
||||||
|
level: 1
|
||||||
|
# RegExp for matching title in front matter
|
||||||
|
front_matter_title: "^\\s*title\\s*[:=]"
|
||||||
|
|
||||||
|
# MD044/proper-names - Proper names should have the correct capitalization
|
||||||
|
MD044:
|
||||||
|
# List of proper names
|
||||||
|
names: []
|
||||||
|
# Include code blocks
|
||||||
|
code_blocks: false
|
||||||
|
|
||||||
|
# MD046/code-block-style - Code block style
|
||||||
|
MD046:
|
||||||
|
# Block style
|
||||||
|
style: "fenced"
|
||||||
|
|
||||||
|
# MD048/code-fence-style - Code fence style
|
||||||
|
MD048:
|
||||||
|
# Code fence syle
|
||||||
|
style: "backtick"
|
31
Dockerfile
31
Dockerfile
@ -1,32 +1,5 @@
|
|||||||
ARG BASE_IMAGE
|
FROM scratch AS build
|
||||||
ARG BUILD_IMAGE
|
|
||||||
|
|
||||||
# BUILD
|
COPY getidev-* /usr/bin/app
|
||||||
# =====================================================================
|
|
||||||
FROM ${BUILD_IMAGE} AS build
|
|
||||||
|
|
||||||
ARG GONOPROXY
|
|
||||||
ARG GONOSUMDB
|
|
||||||
ARG GOPRIVATE
|
|
||||||
ARG GOPROXY
|
|
||||||
ARG GOSUMDB
|
|
||||||
ARG VERSION
|
|
||||||
|
|
||||||
COPY ./ /workspace
|
|
||||||
|
|
||||||
RUN cd /workspace && \
|
|
||||||
GONOPROXY=${GONOPROXY} \
|
|
||||||
GONOSUMDB=${GONOSUMDB} \
|
|
||||||
GOPRIVATE=${GOPRIVATE} \
|
|
||||||
GOPROXY=${GOPROXY} \
|
|
||||||
GOSUMDB=${GOSUMDB} \
|
|
||||||
VERSION=${VERSION} \
|
|
||||||
make all
|
|
||||||
|
|
||||||
# TARGET
|
|
||||||
# =====================================================================
|
|
||||||
FROM ${BASE_IMAGE}
|
|
||||||
|
|
||||||
COPY --from=build /workspace/getidev /usr/bin/getidev
|
|
||||||
|
|
||||||
ENTRYPOINT [ "/usr/bin/getidev" ]
|
ENTRYPOINT [ "/usr/bin/getidev" ]
|
||||||
|
166
Makefile
166
Makefile
@ -1,51 +1,58 @@
|
|||||||
# VERSION
|
EXECUTABLE=getidev
|
||||||
VERSION?=$(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
VERSION?=$(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
# Destination directory and prefix to place the compiled binaries, documentaions
|
||||||
|
# and other files.
|
||||||
|
DESTDIR?=
|
||||||
|
PREFIX?=/usr/local
|
||||||
|
|
||||||
# CONTAINER_RUNTIME
|
# CONTAINER_RUNTIME
|
||||||
CONTAINER_RUNTIME?=$(shell which docker)
|
# The CONTAINER_RUNTIME variable will be used to specified the path to a
|
||||||
|
# container runtime. This is needed to start and run a container image.
|
||||||
|
CONTAINER_RUNTIME?=$(shell which podman)
|
||||||
|
|
||||||
# BUILD_IMAGE
|
# GETIDEV_IMAGE_REGISTRY_NAME
|
||||||
BUILD_IMAGE_REGISTRY_HOST?=docker.io
|
# Defines the name of the new container to be built using several variables.
|
||||||
BUILD_IMAGE_NAMESPACE=library
|
GETIDEV_IMAGE_REGISTRY_NAME:=git.cryptic.systems
|
||||||
BUILD_IMAGE_REPOSITORY=golang
|
GETIDEV_IMAGE_REGISTRY_USER:=volker.raschek
|
||||||
BUILD_IMAGE_VERSION?=1.16
|
|
||||||
BUILD_IMAGE_FULLY_QUALIFIED:=${BUILD_IMAGE_REGISTRY_HOST}/${BUILD_IMAGE_NAMESPACE}/${BUILD_IMAGE_REPOSITORY}:${BUILD_IMAGE_VERSION}
|
|
||||||
|
|
||||||
# BASE_IMAGE
|
GETIDEV_IMAGE_NAMESPACE?=${GETIDEV_IMAGE_REGISTRY_USER}
|
||||||
BASE_IMAGE_REGISTRY_HOST?=docker.io
|
GETIDEV_IMAGE_NAME:=${EXECUTABLE}
|
||||||
BASE_IMAGE_NAMESPACE=library
|
GETIDEV_IMAGE_VERSION?=latest
|
||||||
BASE_IMAGE_REPOSITORY=busybox
|
GETIDEV_IMAGE_FULLY_QUALIFIED=${GETIDEV_IMAGE_REGISTRY_NAME}/${GETIDEV_IMAGE_NAMESPACE}/${GETIDEV_IMAGE_NAME}:${GETIDEV_IMAGE_VERSION}
|
||||||
BASE_IMAGE_VERSION?=latest
|
|
||||||
BASE_IMAGE_FULLY_QUALIFIED=${BASE_IMAGE_REGISTRY_HOST}/${BASE_IMAGE_NAMESPACE}/${BASE_IMAGE_REPOSITORY}:${BASE_IMAGE_VERSION}
|
|
||||||
|
|
||||||
# CONTAINER_IMAGE
|
# BIN
|
||||||
CONTAINER_IMAGE_REGISTRY_HOST?=docker.io
|
|
||||||
CONTAINER_IMAGE_NAMESPACE=volkerraschek
|
|
||||||
CONTAINER_IMAGE_REPOSITORY=getidev
|
|
||||||
CONTAINER_IMAGE_VERSION?=latest
|
|
||||||
CONTAINER_IMAGE_FULLY_QUALIFIED=${CONTAINER_IMAGE_REGISTRY_HOST}/${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_REPOSITORY}:${CONTAINER_IMAGE_VERSION}
|
|
||||||
CONTAINER_IMAGE_UNQUALIFIED=${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_REPOSITORY}:${CONTAINER_IMAGE_VERSION}
|
|
||||||
|
|
||||||
# EXECUTABLES
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
EXECUTABLE_TARGETS=getidev
|
|
||||||
|
|
||||||
PHONY=all
|
|
||||||
all: clean ${EXECUTABLE_TARGETS}
|
|
||||||
|
|
||||||
getidev:
|
getidev:
|
||||||
GOPRIVATE=$(shell go env GOPRIVATE) \
|
CGO_ENABLED=0 \
|
||||||
GOPROXY=$(shell go env GOPROXY) \
|
GOPROXY=$(shell go env GOPROXY) \
|
||||||
GONOPROXY=$(shell go env GONOPROXY) \
|
go build -ldflags "-X 'main.version=${VERSION}'" -o ${@} main.go
|
||||||
GONOSUMDB=$(shell go env GONOSUMDB) \
|
|
||||||
GOSUMDB=$(shell go env GOSUMDB) \
|
|
||||||
go build -tags netgo -ldflags "-X main.version=${VERSION}" -o ${@} main.go
|
|
||||||
|
|
||||||
# CLEAN
|
# CLEAN
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=clean
|
PHONY+=clean
|
||||||
clean:
|
clean:
|
||||||
rm --force --recursive $(shell pwd)/getidev*
|
rm --force --recursive getidev
|
||||||
|
|
||||||
|
# TESTS
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=test/unit
|
||||||
|
test/unit:
|
||||||
|
CGO_ENABLED=0 \
|
||||||
|
GOPROXY=$(shell go env GOPROXY) \
|
||||||
|
go test -v -p 1 -coverprofile=coverage.txt -covermode=count -timeout 1200s ./pkg/...
|
||||||
|
|
||||||
|
# PHONY+=test/integration
|
||||||
|
# test/integration:
|
||||||
|
# CGO_ENABLED=0 \
|
||||||
|
# GOPROXY=$(shell go env GOPROXY) \
|
||||||
|
# go test -v -p 1 -count=1 -timeout 1200s ./it/...
|
||||||
|
|
||||||
|
PHONY+=test/coverage
|
||||||
|
test/coverage: test/unit
|
||||||
|
CGO_ENABLED=0 \
|
||||||
|
GOPROXY=$(shell go env GOPROXY) \
|
||||||
|
go tool cover -html=coverage.txt
|
||||||
|
|
||||||
# GOLANGCI-LINT
|
# GOLANGCI-LINT
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
@ -53,74 +60,55 @@ PHONY+=golangci-lint
|
|||||||
golangci-lint:
|
golangci-lint:
|
||||||
golangci-lint run --concurrency=$(shell nproc)
|
golangci-lint run --concurrency=$(shell nproc)
|
||||||
|
|
||||||
# GOSEC
|
# INSTALL
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=gosec
|
PHONY+=uninstall
|
||||||
gosec:
|
install: getidev
|
||||||
gosec $(shell pwd)/...
|
install --directory ${DESTDIR}/etc/bash_completion.d
|
||||||
|
./getidev completion bash > ${DESTDIR}/etc/bash_completion.d/${EXECUTABLE}
|
||||||
|
|
||||||
# CONTAINER-IMAGE
|
install --directory ${DESTDIR}${PREFIX}/bin
|
||||||
|
install --mode 0755 ${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE}
|
||||||
|
|
||||||
|
install --directory ${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}
|
||||||
|
install --mode 0644 LICENSE ${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}/LICENSE
|
||||||
|
|
||||||
|
# UNINSTALL
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=uninstall
|
||||||
|
uninstall:
|
||||||
|
-rm --force --recursive \
|
||||||
|
${DESTDIR}/etc/bash_completion.d/${EXECUTABLE} \
|
||||||
|
${DESTDIR}${PREFIX}/bin/${EXECUTABLE} \
|
||||||
|
${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}
|
||||||
|
|
||||||
|
# BUILD CONTAINER IMAGE
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=container-image/build
|
PHONY+=container-image/build
|
||||||
container-image/build:
|
container-image/build:
|
||||||
${CONTAINER_RUNTIME} build \
|
${CONTAINER_RUNTIME} build \
|
||||||
--build-arg BASE_IMAGE=${BASE_IMAGE_FULLY_QUALIFIED} \
|
|
||||||
--build-arg BUILD_IMAGE=${BUILD_IMAGE_FULLY_QUALIFIED} \
|
|
||||||
--build-arg GOPRIVATE=$(shell go env GOPRIVATE) \
|
|
||||||
--build-arg GOPROXY=$(shell go env GOPROXY) \
|
|
||||||
--build-arg GONOPROXY=$(shell go env GONOPROXY) \
|
|
||||||
--build-arg GONOSUMDB=$(shell go env GONOSUMDB) \
|
|
||||||
--build-arg GOSUMDB=$(shell go env GOSUMDB) \
|
|
||||||
--build-arg VERSION=${VERSION} \
|
--build-arg VERSION=${VERSION} \
|
||||||
--file ./Dockerfile \
|
--file Dockerfile \
|
||||||
--no-cache \
|
--no-cache \
|
||||||
--tag ${CONTAINER_IMAGE_UNQUALIFIED} \
|
--pull \
|
||||||
--tag ${CONTAINER_IMAGE_FULLY_QUALIFIED} \
|
--tag ${GETIDEV_IMAGE_FULLY_QUALIFIED} \
|
||||||
.
|
.
|
||||||
|
|
||||||
|
# DELETE CONTAINER IMAGE
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY:=container-image/delete
|
||||||
|
container-image/delete:
|
||||||
|
- ${CONTAINER_RUNTIME} image rm ${GETIDEV_IMAGE_FULLY_QUALIFIED}
|
||||||
|
|
||||||
|
# PUSH CONTAINER IMAGE
|
||||||
|
# ==============================================================================
|
||||||
PHONY+=container-image/push
|
PHONY+=container-image/push
|
||||||
container-image/push: container-image/build
|
container-image/push:
|
||||||
${CONTAINER_RUNTIME} push ${CONTAINER_IMAGE_FULLY_QUALIFIED}
|
echo ${GETIDEV_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${GETIDEV_IMAGE_REGISTRY_NAME} --username ${GETIDEV_IMAGE_REGISTRY_USER} --password-stdin
|
||||||
|
${CONTAINER_RUNTIME} push ${GETIDEV_IMAGE_FULLY_QUALIFIED}
|
||||||
# CONTAINER STEPS - EXECUTABLE
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=container-run/all
|
|
||||||
container-run/all:
|
|
||||||
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
|
||||||
|
|
||||||
PHONY+=${EXECUTABLE_TARGETS:%=container-run/%}
|
|
||||||
${EXECUTABLE_TARGETS:%=container-run/%}:
|
|
||||||
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
|
||||||
|
|
||||||
# CONTAINER STEPS - CLEAN
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=container-run/clean
|
|
||||||
container-run/clean:
|
|
||||||
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
|
||||||
|
|
||||||
# GENERAL CONTAINER COMMAND
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=container-run
|
|
||||||
container-run:
|
|
||||||
${CONTAINER_RUNTIME} run \
|
|
||||||
--env CONTAINER_IMAGE_VERSION=${CONTAINER_IMAGE_VERSION} \
|
|
||||||
--env GONOPROXY=$(shell go env GONOPROXY) \
|
|
||||||
--env GONOSUMDB=$(shell go env GONOSUMDB) \
|
|
||||||
--env GOPRIVATE=$(shell go env GOPRIVATE) \
|
|
||||||
--env GOPROXY=$(shell go env GOPROXY) \
|
|
||||||
--env GOSUMDB=$(shell go env GOSUMDB) \
|
|
||||||
--env VERSION=${VERSION} \
|
|
||||||
--net=host \
|
|
||||||
--rm \
|
|
||||||
--volume /tmp:/tmp \
|
|
||||||
--volume ${HOME}/go:/root/go \
|
|
||||||
--volume $(shell pwd):/workspace \
|
|
||||||
--workdir /workspace \
|
|
||||||
${BUILD_IMAGE_FULLY_QUALIFIED} \
|
|
||||||
make ${COMMAND}
|
|
||||||
|
|
||||||
# PHONY
|
# PHONY
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Declare the contents of the PHONY variable as phony. We keep that information
|
# Declare the contents of the PHONY variable as phony. We keep that information
|
||||||
# in a variable so we can use it in if_changed.
|
# in a variable so we can use it in if_changed.
|
||||||
.PHONY: ${PHONY}
|
.PHONY: ${PHONY}
|
||||||
|
14
README.md
14
README.md
@ -1,8 +1,14 @@
|
|||||||
# getidev
|
# getidev
|
||||||
|
|
||||||
`getidev` is a small programme to determine the network interface for an IP
|
[](https://drone.cryptic.systems/volker.raschek/getidev)
|
||||||
address.
|
[](https://hub.docker.com/r/volkerraschek/getidev)
|
||||||
|
|
||||||
|
`getidev` is a small program to determine the network interface name based on a
|
||||||
|
provided ip address.
|
||||||
|
|
||||||
`getidev` serves as an alternative to `ip route get <ip> | awk ...` because `ip
|
`getidev` serves as an alternative to `ip route get <ip> | awk ...` because `ip
|
||||||
route get` can return different output depending on the environment and
|
route get` can return a different output depending on of the distribution and
|
||||||
therefore the construct is unsafe.
|
the installed package versions. For this reason was `getidev` developed to
|
||||||
|
return a stable outout.
|
||||||
|
|
||||||
|
`getidev` is also as container image available: `docker.io/volkerraschek/getidev`.
|
||||||
|
4
go.mod
4
go.mod
@ -1,3 +1,3 @@
|
|||||||
module github.com/volker-raschek/getidev
|
module git.cryptic.systems/volker.raschek/getidev
|
||||||
|
|
||||||
go 1.16
|
go 1.21
|
||||||
|
7
main.go
7
main.go
@ -8,8 +8,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version string
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ips := os.Args[1:]
|
ips := os.Args[1:]
|
||||||
switch {
|
switch {
|
||||||
@ -34,7 +32,10 @@ func main() {
|
|||||||
|
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
if strings.Split(addr.String(), "/")[0] == ip {
|
if strings.Split(addr.String(), "/")[0] == ip {
|
||||||
fmt.Fprintln(os.Stdout, iface.Name)
|
_, err = fmt.Fprintln(os.Stdout, iface.Name)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err.Error())
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
renovate.json
Normal file
10
renovate.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"local>volker.raschek/renovate-config:default#master",
|
||||||
|
"local>volker.raschek/renovate-config:container#master",
|
||||||
|
"local>volker.raschek/renovate-config:actions#master",
|
||||||
|
"local>volker.raschek/renovate-config:golang#master",
|
||||||
|
"local>volker.raschek/renovate-config:regexp#master"
|
||||||
|
]
|
||||||
|
}
|
Reference in New Issue
Block a user