You've already forked getpsrc
Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
4bed79c68b
|
|||
58c51f05f2 | |||
c886afb535
|
|||
bd5f22a613
|
|||
74f2362d46
|
|||
a23f2270b1
|
|||
756d668fc9
|
|||
a91d50bc29
|
|||
b9a337dc58
|
|||
0a602048aa | |||
0feb12b5bd
|
|||
92da52e8d6
|
|||
0a0be0b48c
|
|||
48c7f07eaa
|
|||
46ae2a0bc2
|
|||
86e6c95f6c
|
|||
b0e2cba10d
|
|||
2f62514ce4
|
|||
f7095f0e35
|
|||
f1cf139ab7
|
|||
d9e0eed29a
|
|||
3a3924f0e6
|
|||
c5351b3bb2
|
|||
b313be532e
|
|||
47bf4a6ad7
|
|||
b76a196da2
|
|||
db417ffb8a
|
|||
825b8412ca
|
|||
372d609042
|
|||
2042e25715
|
|||
3a61ee071c
|
|||
ca74f4ef24
|
|||
a252fd2925 | |||
6dcc076b07
|
|||
7266639325
|
|||
e63c96368c
|
|||
f05677e0d3
|
|||
7ecdc659bc | |||
4c4b7eb524
|
|||
3af0527a14
|
|||
9a5987f711
|
|||
3c1d4465fa
|
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
||||
getpsrc
|
@ -1,15 +1,13 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
# Editor configuration, see http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = false
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[Makefile]
|
||||
[{Makefile,*.go}]
|
||||
indent_style = tab
|
10
.gitattributes
vendored
Normal file
10
.gitattributes
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# checkout alls text files with end of line = line feed
|
||||
* text eol=lf
|
||||
|
||||
# Binary files should be checked in and out as binary
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.eot binary
|
||||
*.ttf binary
|
||||
*.pkcs8 binary
|
||||
*.pkcs12 binary
|
24
.gitea/workflows/golang-tests.yaml
Normal file
24
.gitea/workflows/golang-tests.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
name: Golang Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ "opened", "reopened", "synchronize" ]
|
||||
push:
|
||||
branches: [ '**' ]
|
||||
tags-ignore: [ '**' ]
|
||||
|
||||
jobs:
|
||||
unittest:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go: [ stable ]
|
||||
os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/setup-go@v5.5.0
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
- env:
|
||||
GOPROXY: ${{ vars.GOPROXY }}
|
||||
run: make test/unit
|
27
.gitea/workflows/golangci-lint.yaml
Normal file
27
.gitea/workflows/golangci-lint.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
name: Golang CI lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ "opened", "reopened", "synchronize" ]
|
||||
push:
|
||||
branches: [ '**' ]
|
||||
tags-ignore: [ '**' ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
golangci:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go: [ stable ]
|
||||
os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: actions/setup-go@v5.5.0
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
- uses: golangci/golangci-lint-action@v8.0.0
|
||||
with:
|
||||
version: v2.1
|
19
.gitea/workflows/markdown-linters.yaml
Normal file
19
.gitea/workflows/markdown-linters.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
name: Markdown linter
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ "opened", "reopened", "synchronize" ]
|
||||
push:
|
||||
branches: [ '**' ]
|
||||
tags-ignore: [ '**' ]
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
markdown-lint:
|
||||
runs-on:
|
||||
- ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- 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:
|
||||
runs-on:
|
||||
- ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: docker/setup-qemu-action@v3.6.0
|
||||
- uses: actions/setup-go@v5.5.0
|
||||
with:
|
||||
go-version: stable
|
||||
- uses: docker/login-action@v3.4.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"
|
||||
args: release --clean
|
||||
|
||||
sync-to-hub-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/getpsrc:${TAG} \
|
||||
docker://docker.io/volkerraschek/getpsrc:${TAG}
|
20
.gitea/workflows/update-docker-hub-description.yaml
Normal file
20
.gitea/workflows/update-docker-hub-description.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
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.2.2
|
||||
- uses: peter-evans/dockerhub-description@v4.0.2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_IO_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_IO_PASSWORD }}
|
||||
repository: volkerraschek/getpsrc
|
||||
readme-filepath: README.md
|
27
.gitignore
vendored
27
.gitignore
vendored
@ -1 +1,26 @@
|
||||
getpsrc
|
||||
**/*.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*
|
||||
getpsrc*
|
||||
dist
|
@ -1,6 +1,4 @@
|
||||
run:
|
||||
skip-dirs:
|
||||
- it
|
||||
timeout: 10m
|
||||
tests: true
|
||||
|
||||
@ -26,3 +24,4 @@ linters:
|
||||
- rowserrcheck
|
||||
- sqlclosecheck
|
||||
- unparam
|
||||
- whitespace
|
154
.goreleaser.yaml
Normal file
154
.goreleaser.yaml
Normal file
@ -0,0 +1,154 @@
|
||||
project_name: getpsrc
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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'
|
||||
|
||||
gitea_urls:
|
||||
api: https://git.cryptic.systems/api/v1
|
||||
download: https://git.cryptic.systems
|
||||
|
||||
version: 2
|
144
.markdownlint.yaml
Normal file
144
.markdownlint.yaml
Normal file
@ -0,0 +1,144 @@
|
||||
# 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
|
||||
# Include headings
|
||||
headers: 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
|
||||
|
||||
# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content
|
||||
MD024:
|
||||
# Only check sibling headings
|
||||
allow_different_nesting: true
|
||||
|
||||
# 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:
|
||||
- oas-collector
|
||||
# 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
|
||||
ARG BUILD_IMAGE
|
||||
FROM scratch AS build
|
||||
|
||||
# BUILD
|
||||
# =====================================================================
|
||||
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/getpsrc /usr/bin/getpsrc
|
||||
COPY getpsrc-* /usr/bin/getpsrc
|
||||
|
||||
ENTRYPOINT [ "/usr/bin/getpsrc" ]
|
||||
|
65
Makefile
65
Makefile
@ -2,29 +2,13 @@
|
||||
VERSION?=$(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
||||
|
||||
# CONTAINER_RUNTIME
|
||||
CONTAINER_RUNTIME?=$(shell which docker)
|
||||
|
||||
# BUILD_IMAGE
|
||||
BUILD_IMAGE_REGISTRY_HOST?=docker.io
|
||||
BUILD_IMAGE_NAMESPACE=library
|
||||
BUILD_IMAGE_REPOSITORY=golang
|
||||
BUILD_IMAGE_VERSION?=1.16
|
||||
BUILD_IMAGE_FULLY_QUALIFIED:=${BUILD_IMAGE_REGISTRY_HOST}/${BUILD_IMAGE_NAMESPACE}/${BUILD_IMAGE_REPOSITORY}:${BUILD_IMAGE_VERSION}
|
||||
|
||||
# BASE_IMAGE
|
||||
BASE_IMAGE_REGISTRY_HOST?=docker.io
|
||||
BASE_IMAGE_NAMESPACE=library
|
||||
BASE_IMAGE_REPOSITORY=busybox
|
||||
BASE_IMAGE_VERSION?=latest
|
||||
BASE_IMAGE_FULLY_QUALIFIED=${BASE_IMAGE_REGISTRY_HOST}/${BASE_IMAGE_NAMESPACE}/${BASE_IMAGE_REPOSITORY}:${BASE_IMAGE_VERSION}
|
||||
CONTAINER_RUNTIME?=$(shell which podman)
|
||||
|
||||
# CONTAINER_IMAGE
|
||||
CONTAINER_IMAGE_REGISTRY_HOST?=docker.io
|
||||
CONTAINER_IMAGE_NAMESPACE=volkerraschek
|
||||
CONTAINER_IMAGE_REPOSITORY=getpsrc
|
||||
CONTAINER_IMAGE_REGISTRY_HOST?=git.cryptic.systems
|
||||
CONTAINER_IMAGE_REPOSITORY=volker.raschek/getpsrc
|
||||
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}
|
||||
CONTAINER_IMAGE_FULLY_QUALIFIED=${CONTAINER_IMAGE_REGISTRY_HOST}/${CONTAINER_IMAGE_REPOSITORY}:${CONTAINER_IMAGE_VERSION}
|
||||
|
||||
# EXECUTABLES
|
||||
# ==============================================================================
|
||||
@ -34,18 +18,28 @@ PHONY=all
|
||||
all: clean ${EXECUTABLE_TARGETS}
|
||||
|
||||
getpsrc:
|
||||
GOPRIVATE=$(shell go env GOPRIVATE) \
|
||||
GOPROXY=$(shell go env GOPROXY) \
|
||||
GONOPROXY=$(shell go env GONOPROXY) \
|
||||
GONOSUMDB=$(shell go env GONOSUMDB) \
|
||||
GOSUMDB=$(shell go env GOSUMDB) \
|
||||
go build -tags netgo -ldflags "-X main.version=${VERSION}" -o ${@} main.go
|
||||
|
||||
|
||||
# CLEAN
|
||||
# ==============================================================================
|
||||
PHONY+=clean
|
||||
clean:
|
||||
rm --force --recursive $(shell pwd)/getpsrc*
|
||||
rm -f -r $(shell pwd)/getpsrc*
|
||||
|
||||
# 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 ./...
|
||||
|
||||
PHONY+=test/coverage
|
||||
test/coverage: test/unit
|
||||
CGO_ENABLED=0 \
|
||||
GOPROXY=$(shell go env GOPROXY) \
|
||||
go tool cover -html=coverage.txt
|
||||
|
||||
# GOLANGCI-LINT
|
||||
# ==============================================================================
|
||||
@ -64,17 +58,9 @@ gosec:
|
||||
PHONY+=container-image/build
|
||||
container-image/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} \
|
||||
--file ./Dockerfile \
|
||||
--no-cache \
|
||||
--tag ${CONTAINER_IMAGE_UNQUALIFIED} \
|
||||
--tag ${CONTAINER_IMAGE_FULLY_QUALIFIED} \
|
||||
.
|
||||
|
||||
@ -104,18 +90,13 @@ 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 \
|
||||
--volume "${HOME}/go:/root/go" \
|
||||
--volume "$(shell pwd):$(shell pwd)" \
|
||||
--workdir "$(shell pwd)" \
|
||||
${BUILD_IMAGE_FULLY_QUALIFIED} \
|
||||
make ${COMMAND}
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
# getpsrc
|
||||
|
||||
[](https://hub.docker.com/r/volkerraschek/getpsrc)
|
||||
|
||||
`getpsrc` is a small programme to determine the src routing ip for an external ip.
|
||||
|
||||
`getpsrc` serves as an alternative to `ip route get <ip> | awk ... ` because `ip
|
||||
route get` can return different output depending on the environment and
|
||||
therefore the construct is unsafe.
|
||||
`getpsrc` serves as an alternative to `ip route get <ip> | awk ...` because `ip
|
||||
route get` can return different output depending on the environment and therefore the construct is unsafe.
|
||||
|
||||
`getpsrc` is also as container image available: `docker.io/volkerraschek/getpsrc`.
|
||||
|
6
go.mod
6
go.mod
@ -1,5 +1,5 @@
|
||||
module github.com/volker-raschek/getpsrc
|
||||
module git.cryptic.systems/volker.raschek/getpsrc
|
||||
|
||||
go 1.16
|
||||
go 1.21
|
||||
|
||||
require github.com/google/gopacket v1.1.20-0.20210429153827-3eaba0894325
|
||||
require github.com/google/gopacket v1.1.20-0.20250319234736-b7d9dbd15ae4
|
||||
|
17
go.sum
17
go.sum
@ -1,21 +1,14 @@
|
||||
github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
|
||||
github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo=
|
||||
github.com/google/gopacket v1.1.20-0.20210429153827-3eaba0894325 h1:YmIcZ5Var3BAQ64AW98Iiys5Ih4fiU0xK41+8isC5Ec=
|
||||
github.com/google/gopacket v1.1.20-0.20210429153827-3eaba0894325/go.mod h1:riddUzxTSBpJXk3qBHtYr4qOhFhT6k/1c0E3qkQjQpA=
|
||||
github.com/google/gopacket v1.1.20-0.20250319234736-b7d9dbd15ae4 h1:iRhvvcuUeT5yDyWSnZewU+tJvKapX5VjBxqG+gU89FM=
|
||||
github.com/google/gopacket v1.1.20-0.20250319234736-b7d9dbd15ae4/go.mod h1:E8yiKNM3ZzChWoaXdHg08eM+bqgp6nkbaoKwsqVK5Y8=
|
||||
github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0=
|
||||
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
||||
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
|
||||
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f h1:p4VB7kIXpOQvVn1ZaTIVp+3vuYAXFe3OJEvjbUYJLaA=
|
||||
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200217220822-9197077df867 h1:JoRuNIf+rpHl+VhScRQQvzbHed86tKkqwPMV34T8myw=
|
||||
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
54
renovate.json
Normal file
54
renovate.json
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"assigneesFromCodeOwners": true,
|
||||
"labels": [ "renovate" ],
|
||||
"packageRules": [
|
||||
{
|
||||
"description": "Automatically update minor and patch versions of container images",
|
||||
"addLabels": [ "renovate/container-images", "renovate/automerge" ],
|
||||
"automerge": true,
|
||||
"matchDatasources":[ "docker" ],
|
||||
"matchUpdateTypes": [ "minor", "patch"]
|
||||
},
|
||||
{
|
||||
"description": "Prepare MR for major update of container images",
|
||||
"addLabels": [ "renovate/container-images", "renovate/automerge" ],
|
||||
"automerge": false,
|
||||
"matchDatasources":[ "docker" ],
|
||||
"matchUpdateTypes": [ "major"]
|
||||
},
|
||||
{
|
||||
"description": "Automatically update minor and patch versions of used drone-ci images",
|
||||
"addLabels": [ "renovate/droneci", "renovate/automerge" ],
|
||||
"automerge": true,
|
||||
"matchManagers": "droneci",
|
||||
"matchUpdateTypes": [ "minor", "patch"]
|
||||
},
|
||||
{
|
||||
"description": "Prepare MR for major update of used drone-ci images",
|
||||
"addLabels": [ "renovate/droneci", "renovate/automerge" ],
|
||||
"automerge": false,
|
||||
"matchManagers": "droneci",
|
||||
"matchUpdateTypes": [ "major"]
|
||||
},
|
||||
{
|
||||
"description": "Automatically update minor and patch versions of go modules",
|
||||
"addLabels": [ "renovate/gomod", "renovate/automerge" ],
|
||||
"automerge": true,
|
||||
"matchManagers": [ "gomod" ],
|
||||
"matchUpdateTypes": [ "minor", "patch" ]
|
||||
},
|
||||
{
|
||||
"description": "Prepare MR for major update of go modules",
|
||||
"addLabels": [ "renovate/gomod" ],
|
||||
"automerge": false,
|
||||
"matchManagers": [ "gomod" ],
|
||||
"matchUpdateTypes": [ "major" ]
|
||||
}
|
||||
],
|
||||
"postUpdateOptions": [
|
||||
"gomodTidy"
|
||||
],
|
||||
"rebaseLabel": "renovate/rebase",
|
||||
"rebaseWhen": "behind-base-branch"
|
||||
}
|
Reference in New Issue
Block a user