40 Commits

Author SHA1 Message Date
ad1408ad29 chore(deps): update dependency golangci/golangci-lint to v2.4.0 2025-08-14 01:07:00 +00:00
c7d8002cd2 fix(linter): be golangci lint compliant 2025-08-12 09:16:17 +02:00
26e4986b7e fix(ci): rename workflows; add golang ci lint 2025-08-12 09:14:34 +02:00
375c92edaf chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.44.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-04-01 17:09:03 +00:00
13e5e1ea44 chore(deps): update docker.io/plugins/docker docker tag to v20.18.8
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-03-26 20:16:47 +00:00
4703b28598 chore(renopvate): remove obsolete matchBaseBranches
All checks were successful
continuous-integration/drone/push Build is passing
2025-03-22 15:07:14 +00:00
f051599271 chore(deps): update quay.io/skopeo/stable docker tag to v1.18.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-02-28 17:16:27 +00:00
cd19620846 chore(deps): update docker.io/plugins/docker docker tag to v20.18.7
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-02-18 08:14:46 +00:00
56cf4af6c7 Merge pull request 'chore(deps): update docker.io/plugins/docker docker tag to v20.18.6' (#27) from renovate/docker.io-plugins-docker-20.x into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #27
2024-12-29 13:41:35 +00:00
3254b5a722 chore(deps): update docker.io/plugins/docker docker tag to v20.18.6
All checks were successful
continuous-integration/drone/pr Build is passing
2024-12-25 05:13:59 +00:00
726ff9e6c7 chore(deps): update docker.io/library/alpine docker tag to v3.21
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-05 23:13:41 +00:00
806a19f79e chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.43.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-03 14:18:34 +00:00
26533455cc chore(deps): update docker.io/plugins/docker docker tag to v20.18.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-29 11:15:18 +00:00
52dd8914a0 chore(deps): update git.cryptic.systems/volker.raschek/git docker tag to v1.4.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-25 23:17:00 +00:00
45e9282ccd chore(deps): update quay.io/skopeo/stable docker tag to v1.17.0
Some checks reported errors
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build encountered an error
2024-11-21 17:15:18 +00:00
cae06acb21 chore(deps): update quay.io/skopeo/stable docker tag to v1.16.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-15 06:25:07 +00:00
e75a7f7c4b chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.42.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-14 19:17:58 +00:00
5a726d96c5 chore(deps): update docker.io/plugins/docker docker tag to v20.18.4
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-08-22 16:11:15 +00:00
2e0746494a chore(deps): update quay.io/skopeo/stable docker tag to v1.16.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-08-18 16:11:34 +00:00
765d447746 chore(deps): update docker.io/plugins/docker docker tag to v20.18.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-26 12:08:22 +00:00
7fd6def709 chore(deps): update docker.io/plugins/docker docker tag to v20.18.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-23 19:13:44 +00:00
0281bcb254 chore(deps): update quay.io/skopeo/stable docker tag to v1.15.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-16 16:09:19 +00:00
bd8c66cf21 chore(deps): update docker.io/plugins/docker docker tag to v20.18.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-15 22:13:02 +00:00
77732323ba chore(deps): update quay.io/skopeo/stable docker tag to v1.15.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-13 19:13:18 +00:00
5b27b63a49 chore(deps): update docker.io/plugins/docker docker tag to v20.18.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-13 10:58:48 +00:00
4cdb5bac39 chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.41.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-27 13:21:18 +00:00
d2ff11f94f chore(deps): update docker.io/library/alpine docker tag to v3.20
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-22 19:08:40 +00:00
aed2e41d07 chore(deps): update docker.io/plugins/docker docker tag to v20.17.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-20 13:12:02 +00:00
9d1e9a3618 chore(deps): update docker.io/plugins/docker docker tag to v20.17.4
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-13 10:10:33 +00:00
ff53647c83 chore(deps): update docker.io/library/golang docker tag to v1.22.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-08 00:44:35 +00:00
8c9016fa8c chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.40.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-07 22:25:21 +00:00
c80e1bfc52 chore(deps): update quay.io/skopeo/stable docker tag to v1.15.0
All checks were successful
continuous-integration/drone/push Build is passing
2024-04-08 19:16:58 +00:00
8d5776387d chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.39.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-04-08 19:10:58 +00:00
e952b29d5a chore(deps): update docker.io/library/golang docker tag to v1.22.2
All checks were successful
continuous-integration/drone/push Build is passing
2024-04-08 16:19:37 +00:00
d8e74f4605 chore(deps): update docker.io/plugins/docker docker tag to v20.17.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-04-08 16:11:53 +00:00
8538cedbfd fix: update module path and git version
All checks were successful
continuous-integration/drone/push Build is passing
2024-04-08 16:54:31 +02:00
e3962a74db fix: add labels
All checks were successful
continuous-integration/drone/push Build is passing
2024-04-08 16:28:53 +02:00
a25ad8d302 doc(README): add badge
Some checks failed
continuous-integration/drone/push Build is failing
2024-04-08 16:25:05 +02:00
ba74445c54 fix: define images in Dockerfile
Some checks failed
continuous-integration/drone/push Build is failing
2024-04-08 16:22:22 +02:00
0298a6a2bf feat: renovate, update makefile, markdownlint, golancilint, drone integration
Some checks failed
continuous-integration/drone/push Build is failing
2024-04-08 16:18:46 +02:00
18 changed files with 622 additions and 165 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
getidev

View File

@ -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

View 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:
version: v2.4.0 # renovate: datasource=github-releases depName=golangci/golangci-lint

View 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

View 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'

View 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}

View 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
View File

@ -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
View File

@ -0,0 +1,13 @@
version: "2"
linters:
default: standard
enable:
- errname
- gosec
exclusions:
rules: []
warn-unused: true
run:
tests: true

View File

@ -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
View 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
View 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"

View File

@ -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" ]

164
Makefile
View File

@ -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,71 +60,52 @@ 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
# ============================================================================== # ==============================================================================

View File

@ -1,8 +1,14 @@
# getidev # getidev
`getidev` is a small programme to determine the network interface for an IP [![Build Status](https://drone.cryptic.systems/api/badges/volker.raschek/getidev/status.svg)](https://drone.cryptic.systems/volker.raschek/getidev)
address. [![Docker Pulls](https://img.shields.io/docker/pulls/volkerraschek/getidev)](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
View File

@ -1,3 +1,3 @@
module github.com/volker-raschek/getidev module git.cryptic.systems/volker.raschek/getidev
go 1.16 go 1.21

View File

@ -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
View 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"
]
}