You've already forked civ
Compare commits
1 Commits
v0.1.0
...
e0468ead2c
Author | SHA1 | Date | |
---|---|---|---|
e0468ead2c
|
@ -1 +0,0 @@
|
|||||||
civ
|
|
555
.drone.yml
Normal file
555
.drone.yml
Normal file
@ -0,0 +1,555 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: linter
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: markdown lint
|
||||||
|
commands:
|
||||||
|
- markdownlint *.md
|
||||||
|
image: docker.io/volkerraschek/markdownlint:0.43.0
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 50
|
||||||
|
memory: 50M
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
PLUGIN_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
PLUGIN_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
PLUGIN_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
PLUGIN_FROM:
|
||||||
|
from_secret: smtp_mail_address
|
||||||
|
image: docker.io/drillster/drone-email:latest
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 50
|
||||||
|
memory: 25M
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: unit-test
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: unit-test
|
||||||
|
commands:
|
||||||
|
- go test -v ./...
|
||||||
|
image: docker.io/library/golang:1.23
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 250
|
||||||
|
memory: 500M
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- linter
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: dry-run-amd64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:latest
|
||||||
|
settings:
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
auto_tag: false
|
||||||
|
dry_run: true
|
||||||
|
tags: latest-amd64
|
||||||
|
repo: volkerraschek/civ
|
||||||
|
no_cache: true
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: docker.io/drillster/drone-email:latest
|
||||||
|
environment:
|
||||||
|
PLUGIN_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
PLUGIN_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
PLUGIN_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
PLUGIN_FROM:
|
||||||
|
from_secret: smtp_mail_address
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- unit-test
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
exclude:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- pull_request
|
||||||
|
- push
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: dry-run-arm64-v8
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:latest
|
||||||
|
settings:
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
auto_tag: false
|
||||||
|
dry_run: true
|
||||||
|
tags: latest-arm64-v8
|
||||||
|
repo: volkerraschek/civ
|
||||||
|
no_cache: true
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: docker.io/drillster/drone-email:latest
|
||||||
|
environment:
|
||||||
|
PLUGIN_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
PLUGIN_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
PLUGIN_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
PLUGIN_FROM:
|
||||||
|
from_secret: smtp_mail_address
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- unit-test
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
exclude:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- pull_request
|
||||||
|
- push
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: latest-amd64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:latest
|
||||||
|
settings:
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
auto_tag: false
|
||||||
|
tags: latest-amd64
|
||||||
|
repo: volkerraschek/civ
|
||||||
|
username:
|
||||||
|
from_secret: container_image_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: container_image_registry_password
|
||||||
|
no_cache: true
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: docker.io/drillster/drone-email:latest
|
||||||
|
environment:
|
||||||
|
PLUGIN_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
PLUGIN_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
PLUGIN_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
PLUGIN_FROM:
|
||||||
|
from_secret: smtp_mail_address
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- unit-test
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- cron
|
||||||
|
- push
|
||||||
|
repo:
|
||||||
|
- volker.raschek/civ
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: latest-arm64-v8
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:latest
|
||||||
|
settings:
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
auto_tag: false
|
||||||
|
tags: latest-arm64-v8
|
||||||
|
repo: volkerraschek/civ
|
||||||
|
username:
|
||||||
|
from_secret: container_image_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: container_image_registry_password
|
||||||
|
no_cache: true
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: docker.io/drillster/drone-email:latest
|
||||||
|
environment:
|
||||||
|
PLUGIN_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
PLUGIN_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
PLUGIN_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
PLUGIN_FROM:
|
||||||
|
from_secret: smtp_mail_address
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- unit-test
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- cron
|
||||||
|
- push
|
||||||
|
repo:
|
||||||
|
- volker.raschek/civ
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: latest-manifest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build-manifest
|
||||||
|
image: docker.io/plugins/manifest:latest
|
||||||
|
settings:
|
||||||
|
auto_tag: false
|
||||||
|
ignore_missing: true
|
||||||
|
spec: manifest.tmpl
|
||||||
|
username:
|
||||||
|
from_secret: container_image_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: container_image_registry_password
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: docker.io/drillster/drone-email:latest
|
||||||
|
environment:
|
||||||
|
PLUGIN_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
PLUGIN_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
PLUGIN_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
PLUGIN_FROM:
|
||||||
|
from_secret: smtp_mail_address
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 50
|
||||||
|
memory: 25M
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- latest-amd64
|
||||||
|
- latest-arm64-v8
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- cron
|
||||||
|
- push
|
||||||
|
repo:
|
||||||
|
- volker.raschek/civ
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: tagged-amd64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:latest
|
||||||
|
settings:
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: amd64
|
||||||
|
repo: volkerraschek/civ
|
||||||
|
username:
|
||||||
|
from_secret: container_image_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: container_image_registry_password
|
||||||
|
build_args:
|
||||||
|
- VERSION=${DRONE_TAG}
|
||||||
|
no_cache: true
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: docker.io/drillster/drone-email:latest
|
||||||
|
environment:
|
||||||
|
PLUGIN_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
PLUGIN_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
PLUGIN_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
PLUGIN_FROM:
|
||||||
|
from_secret: smtp_mail_address
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
repo:
|
||||||
|
- volker.raschek/civ
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: tagged-arm64-v8
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:latest
|
||||||
|
settings:
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: arm64-v8
|
||||||
|
repo: volkerraschek/civ
|
||||||
|
username:
|
||||||
|
from_secret: container_image_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: container_image_registry_password
|
||||||
|
build_args:
|
||||||
|
- MARKDOWNLINT_VERSION=${DRONE_TAG}
|
||||||
|
no_cache: true
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: docker.io/drillster/drone-email:latest
|
||||||
|
environment:
|
||||||
|
PLUGIN_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
PLUGIN_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
PLUGIN_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
PLUGIN_FROM:
|
||||||
|
from_secret: smtp_mail_address
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: docker_socket
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
repo:
|
||||||
|
- volker.raschek/civ
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: tagged-manifest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build-manifest
|
||||||
|
image: docker.io/plugins/manifest:latest
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
ignore_missing: true
|
||||||
|
spec: manifest.tmpl
|
||||||
|
username:
|
||||||
|
from_secret: container_image_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: container_image_registry_password
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: docker.io/drillster/drone-email:latest
|
||||||
|
environment:
|
||||||
|
PLUGIN_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
PLUGIN_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
PLUGIN_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
PLUGIN_FROM:
|
||||||
|
from_secret: smtp_mail_address
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 50
|
||||||
|
memory: 25M
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- tagged-amd64
|
||||||
|
- tagged-arm64-v8
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
repo:
|
||||||
|
- volker.raschek/civ
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: sync
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: github
|
||||||
|
image: docker.io/appleboy/drone-git-push:latest
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 50
|
||||||
|
memory: 25M
|
||||||
|
settings:
|
||||||
|
branch: master
|
||||||
|
remote: ssh://git@github.com/volker-raschek/civ.git
|
||||||
|
force: true
|
||||||
|
ssh_key:
|
||||||
|
from_secret: ssh_key
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
PLUGIN_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
PLUGIN_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
PLUGIN_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
PLUGIN_FROM:
|
||||||
|
from_secret: smtp_mail_address
|
||||||
|
image: docker.io/drillster/drone-email:latest
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 50
|
||||||
|
memory: 25M
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- latest-manifest
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- cron
|
||||||
|
- push
|
||||||
|
repo:
|
||||||
|
- volker.raschek/civ
|
@ -1,21 +0,0 @@
|
|||||||
name: Golang Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [ "opened", "reopened", "synchronize" ]
|
|
||||||
push:
|
|
||||||
branches: [ '**' ]
|
|
||||||
tags-ignore: [ '**' ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
unittest:
|
|
||||||
runs-on:
|
|
||||||
- ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4.2.2
|
|
||||||
- uses: actions/setup-go@v5.5.0
|
|
||||||
with:
|
|
||||||
go-version: stable
|
|
||||||
- env:
|
|
||||||
GOPROXY: ${{ vars.GOPROXY }}
|
|
||||||
run: make test/unit
|
|
@ -1,20 +0,0 @@
|
|||||||
name: Markdown linter
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [ "opened", "reopened", "synchronize" ]
|
|
||||||
push:
|
|
||||||
branches: [ '**' ]
|
|
||||||
tags-ignore: [ '**' ]
|
|
||||||
workflow_dispatch: {}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
markdown-lint:
|
|
||||||
container:
|
|
||||||
image: git.cryptic.systems/volker.raschek/markdownlint:0.45.0
|
|
||||||
runs-on:
|
|
||||||
- ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4.2.2
|
|
||||||
- name: Lint Markdown files
|
|
||||||
run: markdownlint --config .markdownlint.yaml .
|
|
@ -1,52 +0,0 @@
|
|||||||
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/civ:${TAG} \
|
|
||||||
docker://docker.io/volkerraschek/civ:${TAG}
|
|
@ -1,20 +0,0 @@
|
|||||||
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/civ
|
|
||||||
readme-filepath: README.md
|
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
civ
|
civ*
|
||||||
coverage.txt
|
coverage.txt
|
||||||
dist
|
config*.yml
|
||||||
|
config*.yaml
|
||||||
|
*_result.yml
|
||||||
|
*_result.yaml
|
29
.golangci.yml
Normal file
29
.golangci.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
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
175
.goreleaser.yaml
@ -1,175 +0,0 @@
|
|||||||
project_name: civ
|
|
||||||
|
|
||||||
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
|
|
@ -1,136 +0,0 @@
|
|||||||
# 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"
|
|
1
CODEOWNERS
Normal file
1
CODEOWNERS
Normal file
@ -0,0 +1 @@
|
|||||||
|
* @volker.raschek
|
17
Dockerfile
17
Dockerfile
@ -1,5 +1,18 @@
|
|||||||
FROM scratch AS build
|
FROM docker.io/library/golang:1.17-alpine3.13 AS build
|
||||||
|
|
||||||
COPY civ-* /usr/bin/civ
|
ARG VERSION=latest
|
||||||
|
|
||||||
|
COPY . /workspace
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
|
||||||
|
RUN set -ex && \
|
||||||
|
apk update && \
|
||||||
|
apk add git make && \
|
||||||
|
make install VERSION=${VERSION} DESTDIR=/civ PREFIX=/usr
|
||||||
|
|
||||||
|
FROM docker.io/library/alpine:3.21
|
||||||
|
|
||||||
|
COPY --from=build /civ /
|
||||||
|
|
||||||
ENTRYPOINT [ "/usr/bin/civ" ]
|
ENTRYPOINT [ "/usr/bin/civ" ]
|
113
Makefile
113
Makefile
@ -1,57 +1,49 @@
|
|||||||
EXECUTABLE=civ
|
VERSION?=$(shell git describe --abbrev=0)+$(shell date +'%Y%m%d%H%I%S')
|
||||||
VERSION?=$(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
|
||||||
|
EXECUTABLE:=civ
|
||||||
|
|
||||||
# Destination directory and prefix to place the compiled binaries, documentaions
|
|
||||||
# and other files.
|
|
||||||
DESTDIR?=
|
DESTDIR?=
|
||||||
PREFIX?=/usr/local
|
PREFIX?=/usr/local
|
||||||
|
|
||||||
# CONTAINER_RUNTIME
|
# BINARIES
|
||||||
# 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)
|
|
||||||
|
|
||||||
# DCMERGE_IMAGE_REGISTRY_NAME
|
|
||||||
# Defines the name of the new container to be built using several variables.
|
|
||||||
DCMERGE_IMAGE_REGISTRY_NAME:=git.cryptic.systems
|
|
||||||
DCMERGE_IMAGE_REGISTRY_USER:=volker.raschek
|
|
||||||
|
|
||||||
DCMERGE_IMAGE_NAMESPACE?=${DCMERGE_IMAGE_REGISTRY_USER}
|
|
||||||
DCMERGE_IMAGE_NAME:=${EXECUTABLE}
|
|
||||||
DCMERGE_IMAGE_VERSION?=latest
|
|
||||||
DCMERGE_IMAGE_FULLY_QUALIFIED=${DCMERGE_IMAGE_REGISTRY_NAME}/${DCMERGE_IMAGE_NAMESPACE}/${DCMERGE_IMAGE_NAME}:${DCMERGE_IMAGE_VERSION}
|
|
||||||
|
|
||||||
# BIN
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
civ:
|
all: ${EXECUTABLE}
|
||||||
CGO_ENABLED=0 \
|
|
||||||
|
${EXECUTABLE}:
|
||||||
GOPROXY=$(shell go env GOPROXY) \
|
GOPROXY=$(shell go env GOPROXY) \
|
||||||
go build -ldflags "-X 'main.version=${VERSION}'" -o ${@} main.go
|
GOPRIVATE=$(shell go env GOPRIVATE) \
|
||||||
|
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
|
||||||
|
|
||||||
|
# UN/INSTALL
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=install
|
||||||
|
install: ${EXECUTABLE}
|
||||||
|
install --directory ${DESTDIR}${PREFIX}/bin
|
||||||
|
install --mode 755 ${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE}
|
||||||
|
|
||||||
|
install --directory ${DESTDIR}${PREFIX}/licenses/${EXECUTABLE}
|
||||||
|
install --mode 644 LICENSE ${DESTDIR}${PREFIX}/licenses/${EXECUTABLE}/LICENSE
|
||||||
|
|
||||||
|
PHONY+=uninstall
|
||||||
|
uninstall:
|
||||||
|
-rm --recursive --force \
|
||||||
|
${DESTDIR}${PREFIX}/bin/${EXECUTABLE} \
|
||||||
|
${DESTDIR}${PREFIX}/licenses/${EXECUTABLE}/LICENSE
|
||||||
|
|
||||||
# CLEAN
|
# CLEAN
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=clean
|
PHONY+=clean
|
||||||
clean:
|
clean:
|
||||||
rm --force --recursive civ
|
rm --force --recursive ${EXECUTABLE}* || true
|
||||||
|
|
||||||
# TESTS
|
# TEST
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=test/unit
|
PHONY+=test/unit
|
||||||
test/unit:
|
test/unit:
|
||||||
CGO_ENABLED=0 \
|
go test -v -race -coverprofile=coverage.txt -covermode=atomic -timeout 600s -count=1 ./pkg/...
|
||||||
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
|
PHONY+=test/coverage
|
||||||
test/coverage: test/unit
|
test/coverage: test/unit
|
||||||
CGO_ENABLED=0 \
|
|
||||||
GOPROXY=$(shell go env GOPROXY) \
|
|
||||||
go tool cover -html=coverage.txt
|
go tool cover -html=coverage.txt
|
||||||
|
|
||||||
# GOLANGCI-LINT
|
# GOLANGCI-LINT
|
||||||
@ -60,52 +52,11 @@ PHONY+=golangci-lint
|
|||||||
golangci-lint:
|
golangci-lint:
|
||||||
golangci-lint run --concurrency=$(shell nproc)
|
golangci-lint run --concurrency=$(shell nproc)
|
||||||
|
|
||||||
# INSTALL
|
# GOSEC
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=uninstall
|
PHONY+=gosec
|
||||||
install: civ
|
gosec:
|
||||||
install --directory ${DESTDIR}/etc/bash_completion.d
|
gosec $(shell pwd)/...
|
||||||
./civ completion bash > ${DESTDIR}/etc/bash_completion.d/${EXECUTABLE}
|
|
||||||
|
|
||||||
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
|
|
||||||
container-image/build:
|
|
||||||
${CONTAINER_RUNTIME} build \
|
|
||||||
--build-arg VERSION=${VERSION} \
|
|
||||||
--file Dockerfile \
|
|
||||||
--no-cache \
|
|
||||||
--pull \
|
|
||||||
--tag ${DCMERGE_IMAGE_FULLY_QUALIFIED} \
|
|
||||||
.
|
|
||||||
|
|
||||||
# DELETE CONTAINER IMAGE
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY:=container-image/delete
|
|
||||||
container-image/delete:
|
|
||||||
- ${CONTAINER_RUNTIME} image rm ${DCMERGE_IMAGE_FULLY_QUALIFIED}
|
|
||||||
|
|
||||||
# PUSH CONTAINER IMAGE
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=container-image/push
|
|
||||||
container-image/push:
|
|
||||||
echo ${DCMERGE_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${DCMERGE_IMAGE_REGISTRY_NAME} --username ${DCMERGE_IMAGE_REGISTRY_USER} --password-stdin
|
|
||||||
${CONTAINER_RUNTIME} push ${DCMERGE_IMAGE_FULLY_QUALIFIED}
|
|
||||||
|
|
||||||
# PHONY
|
# PHONY
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
43
README.md
43
README.md
@ -1,11 +1,12 @@
|
|||||||
# civ - container image verifier
|
# civ - container image verifier
|
||||||
|
|
||||||
The container image verifier - `civ` checks based on constraints container images. For this purpose is a config file
|
The container image verifier - `civ` checks based on constraints container
|
||||||
required which contains the constraint definitions. The config file must be passed as argument to `civ`. `civ` writes
|
images. For this purpose is a config file required which contains the constraint
|
||||||
|
definitions. The config file must be passed as argument to `civ`. `civ` writes
|
||||||
the results into a separate file.
|
the results into a separate file.
|
||||||
|
|
||||||
Currently is `json` and `yaml` supported. As default will be `yaml` used. Optionally can be specified via the second arg
|
Currently is `json` and `yaml` supported. As default will be `yaml` used.
|
||||||
the result file.
|
Optionally can be specified via the second arg the result file.
|
||||||
|
|
||||||
`civ config.yaml [ result.yaml ]`
|
`civ config.yaml [ result.yaml ]`
|
||||||
|
|
||||||
@ -15,12 +16,12 @@ the result file.
|
|||||||
|
|
||||||
#### Exists
|
#### Exists
|
||||||
|
|
||||||
Verify if container image `git.cryptic.systems/volker.raschek/civ:latest` has label
|
Verify if container image `volkerraschek/civ:latest` has label
|
||||||
`org.opencontainers.image.documentation` defined.
|
`org.opencontainers.image.documentation` defined.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
images:
|
images:
|
||||||
git.cryptic.systems/volker.raschek/civ:latest:
|
volkerraschek/civ:latest:
|
||||||
labelConstraints:
|
labelConstraints:
|
||||||
org.opencontainers.image.documentation:
|
org.opencontainers.image.documentation:
|
||||||
exists: true
|
exists: true
|
||||||
@ -28,24 +29,25 @@ images:
|
|||||||
|
|
||||||
#### Compare Semantic Versioning
|
#### Compare Semantic Versioning
|
||||||
|
|
||||||
Verify, if the container image `git.cryptic.systems/volker.raschek/civ:latest` has label
|
Verify, if the container image `volkerraschek/civ:latest` has label
|
||||||
`org.opencontainers.image.version` defined and has a greater version than `2.5.7`.
|
`org.opencontainers.image.version` defined and has a greater version than
|
||||||
|
`2.5.7`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
images:
|
images:
|
||||||
git.cryptic.systems/volker.raschek/civ:latest:
|
volkerraschek/civ:latest:
|
||||||
labelConstraints:
|
labelConstraints:
|
||||||
org.opencontainers.image.version:
|
org.opencontainers.image.version:
|
||||||
compareSemver:
|
compareSemver:
|
||||||
greaterThan: 2.5.7
|
greaterThan: 2.5.7
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, can `lessThan` and `equal` be used. For example to define a range of `2.5.7~2.8.4` with `lessThan` and
|
Alternatively, can `lessThan` and `equal` be used. For example to define a range
|
||||||
`greaterThan`.
|
of `2.5.7~2.8.4` with `lessThan` and `greaterThan`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
images:
|
images:
|
||||||
git.cryptic.systems/volker.raschek/civ:latest:
|
volkerraschek/civ:latest:
|
||||||
labelConstraints:
|
labelConstraints:
|
||||||
org.opencontainers.image.version:
|
org.opencontainers.image.version:
|
||||||
compareSemver:
|
compareSemver:
|
||||||
@ -55,12 +57,13 @@ images:
|
|||||||
|
|
||||||
#### Compare String
|
#### Compare String
|
||||||
|
|
||||||
Verify, if the container image `git.cryptic.systems/volker.raschek/civ:latest` has label
|
Verify, if the container image `volkerraschek/civ:latest` has label
|
||||||
`org.opencontainers.image.documentation` defined and the value starts with `https://` and ends with `README.md`.
|
`org.opencontainers.image.documentation` defined and the value starts with
|
||||||
|
`https://` and ends with `README.md`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
images:
|
images:
|
||||||
git.cryptic.systems/volker.raschek/civ:latest:
|
volkerraschek/civ:latest:
|
||||||
labelConstraints:
|
labelConstraints:
|
||||||
org.opencontainers.image.documentation:
|
org.opencontainers.image.documentation:
|
||||||
compareString:
|
compareString:
|
||||||
@ -68,16 +71,18 @@ images:
|
|||||||
hasSuffix: "README.md"
|
hasSuffix: "README.md"
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, can be `equal` used to compare the value of a label with a expected value.
|
Alternatively, can be `equal` used to compare the value of a label with a
|
||||||
|
expected value.
|
||||||
|
|
||||||
#### Count labels with corresponding prefix, suffix or match pattern
|
#### Count labels with corresponding prefix, suffix or match pattern
|
||||||
|
|
||||||
No more than 3 labels with the prefix `org.opencontainers` and exactly one labels with the suffix `version` may be
|
No more than 3 labels with the prefix `org.opencontainers` and exactly one
|
||||||
defined for the image `git.cryptic.systems/volker.raschek/civ:latest`.
|
labels with the suffix `version` may be defined for the image
|
||||||
|
`volkerraschek/civ:latest`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
images:
|
images:
|
||||||
git.cryptic.systems/volker.raschek/civ:latest:
|
volkerraschek/civ:latest:
|
||||||
labelConstraints:
|
labelConstraints:
|
||||||
org.opencontainers%:
|
org.opencontainers%:
|
||||||
count:
|
count:
|
||||||
|
8
go.mod
8
go.mod
@ -1,13 +1,13 @@
|
|||||||
module git.cryptic.systems/volker.raschek/civ
|
module git.cryptic.systems/volker.raschek/civ
|
||||||
|
|
||||||
go 1.24
|
go 1.21
|
||||||
|
|
||||||
toolchain go1.24.3
|
toolchain go1.23.5
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.cryptic.systems/volker.raschek/dockerutils v0.2.0
|
git.cryptic.systems/volker.raschek/dockerutils v0.2.0
|
||||||
github.com/Masterminds/semver/v3 v3.3.1
|
github.com/Masterminds/semver/v3 v3.3.1
|
||||||
github.com/spf13/cobra v1.9.1
|
github.com/spf13/cobra v1.8.1
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ require (
|
|||||||
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6 // indirect
|
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||||
github.com/spf13/pflag v1.0.6 // indirect
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
|
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
|
||||||
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d // indirect
|
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d // indirect
|
||||||
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
|
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
|
||||||
|
10
go.sum
10
go.sum
@ -24,7 +24,7 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH
|
|||||||
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||||
github.com/containerd/containerd v1.4.3 h1:ijQT13JedHSHrQGWFcGEwzcNKrAGIiZ+jSD5QQG07SY=
|
github.com/containerd/containerd v1.4.3 h1:ijQT13JedHSHrQGWFcGEwzcNKrAGIiZ+jSD5QQG07SY=
|
||||||
github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
@ -103,11 +103,11 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
|
|||||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||||
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
|
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
|
||||||
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
|
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
|
||||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
20
manifest.tmpl
Normal file
20
manifest.tmpl
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
image: volkerraschek/civ:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
{{#if build.tags}}
|
||||||
|
tags:
|
||||||
|
{{#each build.tags}}
|
||||||
|
- {{this}}
|
||||||
|
{{/each}}
|
||||||
|
- "latest"
|
||||||
|
{{/if}}
|
||||||
|
manifests:
|
||||||
|
-
|
||||||
|
image: volkerraschek/civ:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{else}}latest{{/if}}-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
||||||
|
-
|
||||||
|
image: volkerraschek/civ:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{else}}latest{{/if}}-arm-v7
|
||||||
|
platform:
|
||||||
|
architecture: arm
|
||||||
|
os: linux
|
||||||
|
variant: v7
|
@ -1,10 +1,26 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": [
|
"assigneesFromCodeOwners": true,
|
||||||
"local>volker.raschek/renovate-config:default#master",
|
"labels": [ "renovate" ],
|
||||||
"local>volker.raschek/renovate-config:container#master",
|
"packageRules": [
|
||||||
"local>volker.raschek/renovate-config:actions#master",
|
{
|
||||||
"local>volker.raschek/renovate-config:golang#master",
|
"description": "Automatically update minor and patch versions of go modules",
|
||||||
"local>volker.raschek/renovate-config:regexp#master"
|
"addLabels": [ "renovate/gomod", "renovate/automerge" ],
|
||||||
]
|
"automerge": true,
|
||||||
|
"matchManagers": [ "gomod" ],
|
||||||
|
"matchUpdateTypes": [ "minor", "patch" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Prepare MR for major update minor 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