You've already forked civ
							
							Compare commits
	
		
			1 Commits
		
	
	
		
			master
			...
			cdfed5e770
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| cdfed5e770 | 
| @@ -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.41.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,13 +1,15 @@ | ||||
| # Editor configuration, see http://editorconfig.org | ||||
| # EditorConfig is awesome: https://EditorConfig.org | ||||
|  | ||||
| # top-most EditorConfig file | ||||
| root = true | ||||
|  | ||||
| [*] | ||||
| charset = utf-8 | ||||
| end_of_line = lf | ||||
| indent_size = 2 | ||||
| indent_style = space | ||||
| insert_final_newline = false | ||||
| indent_size = 2 | ||||
| end_of_line = lf | ||||
| charset = utf-8 | ||||
| trim_trailing_whitespace = true | ||||
| insert_final_newline = false | ||||
|  | ||||
| [{Makefile,*.go}] | ||||
| [Makefile] | ||||
| indent_style = tab | ||||
| @@ -1,29 +0,0 @@ | ||||
| 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@v5.0.0 | ||||
|     - uses: actions/setup-go@v6.0.0 | ||||
|       with: | ||||
|         go-version: ${{ matrix.go }} | ||||
|     - uses: golangci/golangci-lint-action@v8.0.0 | ||||
|       with: | ||||
|         version: v2.6.0 # renovate: datasource=github-releases depName=golangci/golangci-lint | ||||
| @@ -1,42 +0,0 @@ | ||||
| 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@v5.0.0 | ||||
|     - uses: actions/setup-go@v6.0.0 | ||||
|       with: | ||||
|         go-version: ${{ matrix.go }} | ||||
|     - env: | ||||
|         GOPROXY: ${{ vars.GOPROXY }} | ||||
|       run: make test/unit | ||||
| @@ -1,19 +0,0 @@ | ||||
| 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@v5.0.0 | ||||
|     - uses: DavidAnson/markdownlint-cli2-action@v20.0.0 | ||||
|       with: | ||||
|         globs: '**/*.md' | ||||
| @@ -1,52 +0,0 @@ | ||||
| name: "Release" | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     tags: [ '**' ] | ||||
|  | ||||
| permissions: | ||||
|   contents: write | ||||
|  | ||||
| jobs: | ||||
|   release: | ||||
|     name: "Release application" | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|     - uses: actions/checkout@v5.0.0 | ||||
|     - uses: docker/setup-qemu-action@v3.6.0 | ||||
|     - uses: actions/setup-go@v6.0.0 | ||||
|       with: | ||||
|         go-version: stable | ||||
|     - uses: docker/login-action@v3.6.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.4.0 | ||||
|       with: | ||||
|         version: v2.12.7 # renovate: datasource=github-releases depName=goreleaser/goreleaser | ||||
|         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,19 +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@v5.0.0 | ||||
|     - uses: peter-evans/dockerhub-description@v5.0.0 | ||||
|       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 | ||||
| dist | ||||
| config*.yml | ||||
| config*.yaml | ||||
| *_result.yml | ||||
| *_result.yaml | ||||
| @@ -1,13 +0,0 @@ | ||||
| version: "2" | ||||
| linters: | ||||
|   default: standard | ||||
|   enable: | ||||
|   - errname | ||||
|   - gosec | ||||
|  | ||||
|   exclusions: | ||||
|     rules: [] | ||||
|     warn-unused: true | ||||
|  | ||||
| run: | ||||
|   tests: true | ||||
							
								
								
									
										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" ] | ||||
							
								
								
									
										113
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										113
									
								
								Makefile
									
									
									
									
									
								
							| @@ -1,57 +1,49 @@ | ||||
| EXECUTABLE=civ | ||||
| VERSION?=$(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD) | ||||
| VERSION?=$(shell git describe --abbrev=0)+$(shell date +'%Y%m%d%H%I%S') | ||||
|  | ||||
| EXECUTABLE:=civ | ||||
|  | ||||
| # Destination directory and prefix to place the compiled binaries, documentaions | ||||
| # and other files. | ||||
| DESTDIR?= | ||||
| PREFIX?=/usr/local | ||||
|  | ||||
| # CONTAINER_RUNTIME | ||||
| # 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 | ||||
| # BINARIES | ||||
| # ============================================================================== | ||||
| civ: | ||||
| 	CGO_ENABLED=0 \ | ||||
| all: ${EXECUTABLE} | ||||
|  | ||||
| ${EXECUTABLE}: | ||||
| 	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 | ||||
| # ============================================================================== | ||||
| PHONY+=clean | ||||
| clean: | ||||
| 	rm --force --recursive civ | ||||
| 	rm --force --recursive ${EXECUTABLE}* || true | ||||
|  | ||||
| # TESTS | ||||
| # TEST | ||||
| # ============================================================================== | ||||
| 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/... | ||||
| 	go test -v -race -coverprofile=coverage.txt -covermode=atomic -timeout 600s -count=1 ./pkg/... | ||||
|  | ||||
| PHONY+=test/coverage | ||||
| test/coverage: test/unit | ||||
| 	CGO_ENABLED=0 \ | ||||
| 	GOPROXY=$(shell go env GOPROXY) \ | ||||
| 	go tool cover -html=coverage.txt | ||||
|  | ||||
| # GOLANGCI-LINT | ||||
| @@ -60,52 +52,11 @@ PHONY+=golangci-lint | ||||
| golangci-lint: | ||||
| 	golangci-lint run --concurrency=$(shell nproc) | ||||
|  | ||||
| # INSTALL | ||||
| # GOSEC | ||||
| # ============================================================================== | ||||
| PHONY+=uninstall | ||||
| install: civ | ||||
| 	install --directory ${DESTDIR}/etc/bash_completion.d | ||||
| 	./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+=gosec | ||||
| gosec: | ||||
| 	gosec $(shell pwd)/... | ||||
|  | ||||
| # PHONY | ||||
| # ============================================================================== | ||||
|   | ||||
							
								
								
									
										43
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,11 +1,12 @@ | ||||
| # civ - container image verifier | ||||
|  | ||||
| The container image verifier - `civ` checks based on constraints container 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 container image verifier - `civ` checks based on constraints container | ||||
| 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. | ||||
|  | ||||
| Currently is `json` and `yaml` supported. As default will be `yaml` used. Optionally can be specified via the second arg | ||||
| the result file. | ||||
| Currently is `json` and `yaml` supported. As default will be `yaml` used. | ||||
| Optionally can be specified via the second arg the result file. | ||||
|  | ||||
| `civ config.yaml [ result.yaml ]` | ||||
|  | ||||
| @@ -15,12 +16,12 @@ the result file. | ||||
|  | ||||
| #### 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. | ||||
|  | ||||
| ```yaml | ||||
| images: | ||||
|   git.cryptic.systems/volker.raschek/civ:latest: | ||||
|   volkerraschek/civ:latest: | ||||
|     labelConstraints: | ||||
|       org.opencontainers.image.documentation: | ||||
|         exists: true | ||||
| @@ -28,24 +29,25 @@ images: | ||||
|  | ||||
| #### Compare Semantic Versioning | ||||
|  | ||||
| Verify, if the container image `git.cryptic.systems/volker.raschek/civ:latest` has label | ||||
| `org.opencontainers.image.version` defined and has a greater version than `2.5.7`. | ||||
| Verify, if the container image `volkerraschek/civ:latest` has label | ||||
| `org.opencontainers.image.version` defined and has a greater version than | ||||
| `2.5.7`. | ||||
|  | ||||
| ```yaml | ||||
| images: | ||||
|   git.cryptic.systems/volker.raschek/civ:latest: | ||||
|   volkerraschek/civ:latest: | ||||
|     labelConstraints: | ||||
|       org.opencontainers.image.version: | ||||
|         compareSemver: | ||||
|           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 | ||||
| `greaterThan`. | ||||
| Alternatively, can `lessThan` and `equal` be used. For example to define a range | ||||
| of `2.5.7~2.8.4` with `lessThan` and `greaterThan`. | ||||
|  | ||||
| ```yaml | ||||
| images: | ||||
|   git.cryptic.systems/volker.raschek/civ:latest: | ||||
|   volkerraschek/civ:latest: | ||||
|     labelConstraints: | ||||
|       org.opencontainers.image.version: | ||||
|         compareSemver: | ||||
| @@ -55,12 +57,13 @@ images: | ||||
|  | ||||
| #### Compare String | ||||
|  | ||||
| Verify, if the container image `git.cryptic.systems/volker.raschek/civ:latest` has label | ||||
| `org.opencontainers.image.documentation` defined and the value starts with `https://` and ends with `README.md`. | ||||
| 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`. | ||||
|  | ||||
| ```yaml | ||||
| images: | ||||
|   git.cryptic.systems/volker.raschek/civ:latest: | ||||
|   volkerraschek/civ:latest: | ||||
|     labelConstraints: | ||||
|       org.opencontainers.image.documentation: | ||||
|         compareString: | ||||
| @@ -68,16 +71,18 @@ images: | ||||
|           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 | ||||
|  | ||||
| No more than 3 labels with the prefix `org.opencontainers` and exactly one labels with the suffix `version` may be | ||||
| defined for the image `git.cryptic.systems/volker.raschek/civ:latest`. | ||||
| No more than 3 labels with the prefix `org.opencontainers` and exactly one | ||||
| labels with the suffix `version` may be defined for the image | ||||
| `volkerraschek/civ:latest`. | ||||
|  | ||||
| ```yaml | ||||
| images: | ||||
|   git.cryptic.systems/volker.raschek/civ:latest: | ||||
|   volkerraschek/civ:latest: | ||||
|     labelConstraints: | ||||
|       org.opencontainers%: | ||||
|         count: | ||||
|   | ||||
							
								
								
									
										12
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								go.mod
									
									
									
									
									
								
							| @@ -1,14 +1,14 @@ | ||||
| module git.cryptic.systems/volker.raschek/civ | ||||
|  | ||||
| go 1.24 | ||||
| go 1.21 | ||||
|  | ||||
| toolchain go1.25.3 | ||||
| toolchain go1.23.5 | ||||
|  | ||||
| require ( | ||||
| 	git.cryptic.systems/volker.raschek/dockerutils v0.2.0 | ||||
| 	github.com/Masterminds/semver/v3 v3.4.0 | ||||
| 	github.com/spf13/cobra v1.10.1 | ||||
| 	gopkg.in/yaml.v2 v2.4.0 | ||||
| 	github.com/Masterminds/semver/v3 v3.3.1 | ||||
| 	github.com/spf13/cobra v1.8.1 | ||||
| 	gopkg.in/yaml.v3 v3.0.1 | ||||
| ) | ||||
|  | ||||
| require ( | ||||
| @@ -25,7 +25,7 @@ require ( | ||||
| 	github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6 // indirect | ||||
| 	github.com/pkg/errors v0.9.1 // indirect | ||||
| 	github.com/sirupsen/logrus v1.8.1 // indirect | ||||
| 	github.com/spf13/pflag v1.0.9 // indirect | ||||
| 	github.com/spf13/pflag v1.0.5 // indirect | ||||
| 	golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect | ||||
| 	golang.org/x/sys v0.0.0-20211205182925-97ca703d548d // indirect | ||||
| 	google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect | ||||
|   | ||||
							
								
								
									
										14
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								go.sum
									
									
									
									
									
								
							| @@ -5,8 +5,8 @@ git.cryptic.systems/volker.raschek/dockerutils v0.2.0/go.mod h1:c4ZZpD2unnzwr7qH | ||||
| github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= | ||||
| github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= | ||||
| github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | ||||
| github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= | ||||
| github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= | ||||
| github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4= | ||||
| github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= | ||||
| github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= | ||||
| github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= | ||||
| github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= | ||||
| @@ -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/containerd/containerd v1.4.3 h1:ijQT13JedHSHrQGWFcGEwzcNKrAGIiZ+jSD5QQG07SY= | ||||
| 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/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= | ||||
| @@ -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/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= | ||||
| github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= | ||||
| github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= | ||||
| github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= | ||||
| github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= | ||||
| 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.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= | ||||
| github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= | ||||
| github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= | ||||
| 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.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||||
| github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= | ||||
|   | ||||
							
								
								
									
										2
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.go
									
									
									
									
									
								
							| @@ -5,5 +5,5 @@ import "git.cryptic.systems/volker.raschek/civ/cmd" | ||||
| var version string | ||||
|  | ||||
| func main() { | ||||
| 	_ = cmd.Execute(version) | ||||
| 	cmd.Execute(version) | ||||
| } | ||||
|   | ||||
							
								
								
									
										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 | ||||
| @@ -65,7 +65,7 @@ func (jr *JSONReader) ReadFile() (*domain.Config, error) { | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	defer func() { _ = f.Close() }() | ||||
| 	defer f.Close() | ||||
|  | ||||
| 	return jr.read(f) | ||||
| } | ||||
| @@ -79,7 +79,7 @@ func (jw *JSONWriter) WriteFile(config *domain.Config) error { | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	defer func() { _ = f.Close() }() | ||||
| 	defer func() { f.Close() }() | ||||
| 	return jw.write(f, config) | ||||
| } | ||||
|  | ||||
| @@ -103,7 +103,7 @@ func (yr *YAMLReader) ReadFile() (*domain.Config, error) { | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	defer func() { _ = f.Close() }() | ||||
| 	defer f.Close() | ||||
|  | ||||
| 	return yr.read(f) | ||||
| } | ||||
| @@ -129,7 +129,7 @@ func (yw *YAMLWriter) WriteFile(config *domain.Config) error { | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	defer func() { _ = f.Close() }() | ||||
| 	defer func() { f.Close() }() | ||||
| 	return yw.write(f, config) | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -182,7 +182,7 @@ func labelCompareSemver(compareSemver *domain.LabelConstraintCompareSemver, pars | ||||
| } | ||||
|  | ||||
| func labelCompareString(compareString *domain.LabelConstraintCompareString, labelValue string) bool { | ||||
| 	var majorState = true | ||||
| 	var majorState bool = true | ||||
|  | ||||
| 	// Equal | ||||
| 	if compareString.Equal != "" { | ||||
| @@ -224,7 +224,7 @@ func labelCompareString(compareString *domain.LabelConstraintCompareString, labe | ||||
| } | ||||
|  | ||||
| func labelCount(re *regexp.Regexp, labelConstraintCounter *domain.LabelConstraintCounter, labels map[string]string) bool { | ||||
| 	var majorState = true | ||||
| 	var majorState bool = true | ||||
|  | ||||
| 	var i uint = 0 | ||||
| 	for key := range labels { | ||||
|   | ||||
| @@ -1,10 +1,26 @@ | ||||
| { | ||||
|   "$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" | ||||
|   ] | ||||
|   "assigneesFromCodeOwners": true, | ||||
|   "labels": [ "renovate" ], | ||||
|   "packageRules": [ | ||||
|     { | ||||
|       "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 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