You've already forked dcmerge
Compare commits
1 Commits
master
...
23d77dc322
Author | SHA1 | Date | |
---|---|---|---|
23d77dc322
|
727
.drone.yml
Normal file
727
.drone.yml
Normal file
@ -0,0 +1,727 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: linter
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: markdown lint
|
||||||
|
commands:
|
||||||
|
- markdownlint *.md
|
||||||
|
image: git.cryptic.systems/volker.raschek/markdownlint:0.43.0
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 150
|
||||||
|
memory: 150M
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
SMTP_FROM_ADDRESS:
|
||||||
|
from_secret: smtp_from_address
|
||||||
|
SMTP_FROM_NAME:
|
||||||
|
from_secret: smtp_from_name
|
||||||
|
SMTP_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
SMTP_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
SMTP_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 150
|
||||||
|
memory: 150M
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: unit-test-amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
platform:
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: unit-test
|
||||||
|
commands:
|
||||||
|
- go test -v ./...
|
||||||
|
image: docker.io/library/golang:1.24.1
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: unit-test-arm64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
platform:
|
||||||
|
arch: arm64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: unit-test
|
||||||
|
commands:
|
||||||
|
- go test -v ./...
|
||||||
|
image: docker.io/library/golang:1.24.1
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
include:
|
||||||
|
- pull_request
|
||||||
|
- push
|
||||||
|
exclude:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: dry-run-amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- linter
|
||||||
|
- unit-test-amd64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:20.18.7
|
||||||
|
settings:
|
||||||
|
auto_tag: false
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
dry_run: true
|
||||||
|
force_tag: true
|
||||||
|
no_cache: true
|
||||||
|
purge: true
|
||||||
|
mirror:
|
||||||
|
from_secret: docker_io_mirror
|
||||||
|
registry: git.cryptic.systems
|
||||||
|
repo: git.cryptic.systems/volker.raschek/dcmerge
|
||||||
|
tags: latest-amd64
|
||||||
|
username:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_password
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
SMTP_FROM_ADDRESS:
|
||||||
|
from_secret: smtp_from_address
|
||||||
|
SMTP_FROM_NAME:
|
||||||
|
from_secret: smtp_from_name
|
||||||
|
SMTP_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
SMTP_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
SMTP_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
exclude:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- pull_request
|
||||||
|
- push
|
||||||
|
repo:
|
||||||
|
- volker.raschek/dcmerge
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: dry-run-arm64-v8
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- linter
|
||||||
|
- unit-test-arm64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:20.18.7
|
||||||
|
settings:
|
||||||
|
auto_tag: false
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
dry_run: true
|
||||||
|
force_tag: true
|
||||||
|
no_cache: true
|
||||||
|
purge: true
|
||||||
|
mirror:
|
||||||
|
from_secret: docker_io_mirror
|
||||||
|
registry: git.cryptic.systems
|
||||||
|
repo: git.cryptic.systems/volker.raschek/dcmerge
|
||||||
|
tags: latest-arm64-v8
|
||||||
|
username:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_password
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
SMTP_FROM_ADDRESS:
|
||||||
|
from_secret: smtp_from_address
|
||||||
|
SMTP_FROM_NAME:
|
||||||
|
from_secret: smtp_from_name
|
||||||
|
SMTP_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
SMTP_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
SMTP_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
exclude:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- pull_request
|
||||||
|
- push
|
||||||
|
repo:
|
||||||
|
- volker.raschek/dcmerge
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: latest-amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- linter
|
||||||
|
- unit-test-amd64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:20.18.7
|
||||||
|
settings:
|
||||||
|
auto_tag: false
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
force_tag: true
|
||||||
|
no_cache: true
|
||||||
|
purge: true
|
||||||
|
mirror:
|
||||||
|
from_secret: docker_io_mirror
|
||||||
|
registry: git.cryptic.systems
|
||||||
|
repo: git.cryptic.systems/volker.raschek/dcmerge
|
||||||
|
tags: latest-amd64
|
||||||
|
username:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_password
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
SMTP_FROM_ADDRESS:
|
||||||
|
from_secret: smtp_from_address
|
||||||
|
SMTP_FROM_NAME:
|
||||||
|
from_secret: smtp_from_name
|
||||||
|
SMTP_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
SMTP_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
SMTP_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- cron
|
||||||
|
- push
|
||||||
|
repo:
|
||||||
|
- volker.raschek/dcmerge
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: latest-arm64-v8
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- linter
|
||||||
|
- unit-test-arm64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:20.18.7
|
||||||
|
settings:
|
||||||
|
auto_tag: false
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
force_tag: true
|
||||||
|
no_cache: true
|
||||||
|
purge: true
|
||||||
|
mirror:
|
||||||
|
from_secret: docker_io_mirror
|
||||||
|
registry: git.cryptic.systems
|
||||||
|
repo: git.cryptic.systems/volker.raschek/dcmerge
|
||||||
|
tags: latest-arm64-v8
|
||||||
|
username:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_password
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
SMTP_FROM_ADDRESS:
|
||||||
|
from_secret: smtp_from_address
|
||||||
|
SMTP_FROM_NAME:
|
||||||
|
from_secret: smtp_from_name
|
||||||
|
SMTP_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
SMTP_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
SMTP_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- cron
|
||||||
|
- push
|
||||||
|
repo:
|
||||||
|
- volker.raschek/dcmerge
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: latest-manifest
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- latest-amd64
|
||||||
|
- latest-arm64-v8
|
||||||
|
|
||||||
|
# docker.io/plugins/manifest only for amd64 architectures available
|
||||||
|
node_selector:
|
||||||
|
kubernetes.io/os: linux
|
||||||
|
kubernetes.io/arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: build-manifest
|
||||||
|
image: docker.io/plugins/manifest:1.4.0
|
||||||
|
settings:
|
||||||
|
auto_tag: false
|
||||||
|
ignore_missing: true
|
||||||
|
spec: manifest.tmpl
|
||||||
|
username:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_password
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
SMTP_FROM_ADDRESS:
|
||||||
|
from_secret: smtp_from_address
|
||||||
|
SMTP_FROM_NAME:
|
||||||
|
from_secret: smtp_from_name
|
||||||
|
SMTP_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
SMTP_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
SMTP_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 150
|
||||||
|
memory: 150M
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- cron
|
||||||
|
- push
|
||||||
|
repo:
|
||||||
|
- volker.raschek/dcmerge
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: latest-sync
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- latest-manifest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: latest-sync
|
||||||
|
commands:
|
||||||
|
- skopeo sync --all --src=docker --src-creds=$SRC_CRED_USERNAME:$SRC_CRED_PASSWORD --dest=docker --dest-creds=$DEST_CRED_USERNAME:$DEST_CRED_PASSWORD git.cryptic.systems/volker.raschek/dcmerge docker.io/volkerraschek
|
||||||
|
environment:
|
||||||
|
SRC_CRED_USERNAME:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_user
|
||||||
|
SRC_CRED_PASSWORD:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_password
|
||||||
|
DEST_CRED_USERNAME:
|
||||||
|
from_secret: container_image_registry_user
|
||||||
|
DEST_CRED_PASSWORD:
|
||||||
|
from_secret: container_image_registry_password
|
||||||
|
image: quay.io/skopeo/stable:v1.18.0
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
SMTP_FROM_ADDRESS:
|
||||||
|
from_secret: smtp_from_address
|
||||||
|
SMTP_FROM_NAME:
|
||||||
|
from_secret: smtp_from_name
|
||||||
|
SMTP_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
SMTP_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
SMTP_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 150
|
||||||
|
memory: 150M
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- cron
|
||||||
|
- push
|
||||||
|
repo:
|
||||||
|
- volker.raschek/dcmerge
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: tagged-amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:20.18.7
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: amd64
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
force_tag: true
|
||||||
|
no_cache: true
|
||||||
|
purge: true
|
||||||
|
mirror:
|
||||||
|
from_secret: docker_io_mirror
|
||||||
|
registry: git.cryptic.systems
|
||||||
|
repo: git.cryptic.systems/volker.raschek/dcmerge
|
||||||
|
username:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_password
|
||||||
|
build_args:
|
||||||
|
- VERSION=${DRONE_TAG}
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
SMTP_FROM_ADDRESS:
|
||||||
|
from_secret: smtp_from_address
|
||||||
|
SMTP_FROM_NAME:
|
||||||
|
from_secret: smtp_from_name
|
||||||
|
SMTP_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
SMTP_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
SMTP_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
repo:
|
||||||
|
- volker.raschek/dcmerge
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: tagged-arm64-v8
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: docker.io/plugins/docker:20.18.7
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: arm64-v8
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
force_tag: true
|
||||||
|
no_cache: true
|
||||||
|
purge: true
|
||||||
|
mirror:
|
||||||
|
from_secret: docker_io_mirror
|
||||||
|
registry: git.cryptic.systems
|
||||||
|
repo: git.cryptic.systems/volker.raschek/dcmerge
|
||||||
|
username:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_password
|
||||||
|
build_args:
|
||||||
|
- VERSION=${DRONE_TAG}
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
SMTP_FROM_ADDRESS:
|
||||||
|
from_secret: smtp_from_address
|
||||||
|
SMTP_FROM_NAME:
|
||||||
|
from_secret: smtp_from_name
|
||||||
|
SMTP_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
SMTP_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
SMTP_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
repo:
|
||||||
|
- volker.raschek/dcmerge
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: tagged-manifest
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- tagged-amd64
|
||||||
|
- tagged-arm64-v8
|
||||||
|
|
||||||
|
# docker.io/plugins/manifest only for amd64 architectures available
|
||||||
|
node_selector:
|
||||||
|
kubernetes.io/os: linux
|
||||||
|
kubernetes.io/arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: build-manifest
|
||||||
|
image: docker.io/plugins/manifest:1.4.0
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
ignore_missing: true
|
||||||
|
spec: manifest.tmpl
|
||||||
|
username:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_user
|
||||||
|
password:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_password
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
SMTP_FROM_ADDRESS:
|
||||||
|
from_secret: smtp_from_address
|
||||||
|
SMTP_FROM_NAME:
|
||||||
|
from_secret: smtp_from_name
|
||||||
|
SMTP_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
SMTP_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
SMTP_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 150
|
||||||
|
memory: 150M
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
repo:
|
||||||
|
- volker.raschek/dcmerge
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: tagged-sync
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- tagged-manifest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: clone
|
||||||
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
|
- name: tagged-sync
|
||||||
|
commands:
|
||||||
|
- skopeo sync --all --src=docker --src-creds=$SRC_CRED_USERNAME:$SRC_CRED_PASSWORD --dest=docker --dest-creds=$DEST_CRED_USERNAME:$DEST_CRED_PASSWORD git.cryptic.systems/volker.raschek/dcmerge docker.io/volkerraschek
|
||||||
|
environment:
|
||||||
|
SRC_CRED_USERNAME:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_user
|
||||||
|
SRC_CRED_PASSWORD:
|
||||||
|
from_secret: git_cryptic_systems_container_registry_password
|
||||||
|
DEST_CRED_USERNAME:
|
||||||
|
from_secret: container_image_registry_user
|
||||||
|
DEST_CRED_PASSWORD:
|
||||||
|
from_secret: container_image_registry_password
|
||||||
|
image: quay.io/skopeo/stable:v1.18.0
|
||||||
|
|
||||||
|
- name: email-notification
|
||||||
|
environment:
|
||||||
|
SMTP_FROM_ADDRESS:
|
||||||
|
from_secret: smtp_from_address
|
||||||
|
SMTP_FROM_NAME:
|
||||||
|
from_secret: smtp_from_name
|
||||||
|
SMTP_HOST:
|
||||||
|
from_secret: smtp_host
|
||||||
|
SMTP_USERNAME:
|
||||||
|
from_secret: smtp_username
|
||||||
|
SMTP_PASSWORD:
|
||||||
|
from_secret: smtp_password
|
||||||
|
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 150
|
||||||
|
memory: 150M
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- changed
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
repo:
|
||||||
|
- volker.raschek/dcmerge
|
@ -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@v4.3.0
|
|
||||||
- uses: actions/setup-go@v5.5.0
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go }}
|
|
||||||
- uses: golangci/golangci-lint-action@v8.0.0
|
|
||||||
with:
|
|
||||||
version: v2.4.0 # renovate: datasource=github-releases depName=golangci/golangci-lint
|
|
@ -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@v4.3.0
|
|
||||||
- uses: actions/setup-go@v5.5.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@v4.3.0
|
|
||||||
- uses: DavidAnson/markdownlint-cli2-action@v20.0.0
|
|
||||||
with:
|
|
||||||
globs: '**/*.md'
|
|
@ -1,53 +0,0 @@
|
|||||||
name: "Release"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: [ '**' ]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
name: "Release application"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4.3.0
|
|
||||||
- uses: docker/setup-qemu-action@v3.6.0
|
|
||||||
- uses: actions/setup-go@v5.5.0
|
|
||||||
with:
|
|
||||||
go-version: stable
|
|
||||||
- uses: docker/login-action@v3.5.0
|
|
||||||
with:
|
|
||||||
registry: git.cryptic.systems
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }}
|
|
||||||
- env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }}
|
|
||||||
GONOSUMDB: ${{ vars.GONOSUMDB }}
|
|
||||||
GOPROXY: ${{ vars.GOPROXY }}
|
|
||||||
uses: goreleaser/goreleaser-action@v6.4.0
|
|
||||||
with:
|
|
||||||
version: v2.11.2 # renovate: datasource=github-releases depName=goreleaser/goreleaser
|
|
||||||
args: release --clean
|
|
||||||
|
|
||||||
sync-to-hub-docker-io:
|
|
||||||
name: "Upload Images to docker.io"
|
|
||||||
needs:
|
|
||||||
- release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Copy images to docker.io
|
|
||||||
run: |
|
|
||||||
TAG=$(echo ${{ github.ref_name }} | sed 's/v//gm')
|
|
||||||
|
|
||||||
apt-get update --yes
|
|
||||||
apt-get install --yes skopeo
|
|
||||||
skopeo copy \
|
|
||||||
--all \
|
|
||||||
--dest-password ${{ secrets.DOCKER_IO_PASSWORD }} \
|
|
||||||
--dest-username ${{ secrets.DOCKER_IO_USERNAME }} \
|
|
||||||
--src-password ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }} \
|
|
||||||
--src-username volker.raschek \
|
|
||||||
docker://git.cryptic.systems/volker.raschek/dcmerge:${TAG} \
|
|
||||||
docker://docker.io/volkerraschek/dcmerge:${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@v4.3.0
|
|
||||||
- uses: peter-evans/dockerhub-description@v4.0.2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_IO_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_IO_PASSWORD }}
|
|
||||||
repository: volkerraschek/dcmerge
|
|
||||||
readme-filepath: README.md
|
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
dcmerge
|
dcmerge
|
||||||
coverage.txt
|
coverage.txt
|
||||||
dist
|
|
@ -1,13 +0,0 @@
|
|||||||
version: "2"
|
|
||||||
linters:
|
|
||||||
default: standard
|
|
||||||
enable:
|
|
||||||
- errname
|
|
||||||
- gosec
|
|
||||||
|
|
||||||
exclusions:
|
|
||||||
rules: []
|
|
||||||
warn-unused: true
|
|
||||||
|
|
||||||
run:
|
|
||||||
tests: true
|
|
175
.goreleaser.yaml
175
.goreleaser.yaml
@ -1,175 +0,0 @@
|
|||||||
project_name: dcmerge
|
|
||||||
|
|
||||||
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
|
|
@ -56,6 +56,8 @@ MD013:
|
|||||||
tables: false
|
tables: false
|
||||||
# Include headings
|
# Include headings
|
||||||
headings: true
|
headings: true
|
||||||
|
# Include headings
|
||||||
|
headers: true
|
||||||
# Strict length checking
|
# Strict length checking
|
||||||
strict: false
|
strict: false
|
||||||
# Stern length checking
|
# Stern length checking
|
||||||
@ -68,6 +70,11 @@ MD022:
|
|||||||
# Blank lines below heading
|
# Blank lines below heading
|
||||||
lines_below: 1
|
lines_below: 1
|
||||||
|
|
||||||
|
# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content
|
||||||
|
MD024:
|
||||||
|
# Only check sibling headings
|
||||||
|
allow_different_nesting: true
|
||||||
|
|
||||||
# MD025/single-title/single-h1 - Multiple top-level headings in the same document
|
# MD025/single-title/single-h1 - Multiple top-level headings in the same document
|
||||||
MD025:
|
MD025:
|
||||||
# Heading level
|
# Heading level
|
||||||
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"rewrap.wrappingColumn": 120,
|
||||||
|
}
|
19
Dockerfile
19
Dockerfile
@ -1,5 +1,20 @@
|
|||||||
FROM scratch AS build
|
FROM docker.io/library/golang:1.23.4-alpine3.19 AS build
|
||||||
|
|
||||||
COPY dcmerge-* /usr/bin/dcmerge
|
RUN apk add git make
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
ADD ./ /workspace
|
||||||
|
|
||||||
|
RUN make install \
|
||||||
|
DESTDIR=/cache \
|
||||||
|
PREFIX=/usr \
|
||||||
|
VERSION=${VERSION}
|
||||||
|
|
||||||
|
FROM docker.io/library/alpine:3.21
|
||||||
|
|
||||||
|
COPY --from=build /cache /
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
VOLUME [ "/workspace" ]
|
||||||
|
|
||||||
ENTRYPOINT [ "/usr/bin/dcmerge" ]
|
ENTRYPOINT [ "/usr/bin/dcmerge" ]
|
20
Makefile
20
Makefile
@ -20,12 +20,17 @@ DCMERGE_IMAGE_NAMESPACE?=${DCMERGE_IMAGE_REGISTRY_USER}
|
|||||||
DCMERGE_IMAGE_NAME:=${EXECUTABLE}
|
DCMERGE_IMAGE_NAME:=${EXECUTABLE}
|
||||||
DCMERGE_IMAGE_VERSION?=latest
|
DCMERGE_IMAGE_VERSION?=latest
|
||||||
DCMERGE_IMAGE_FULLY_QUALIFIED=${DCMERGE_IMAGE_REGISTRY_NAME}/${DCMERGE_IMAGE_NAMESPACE}/${DCMERGE_IMAGE_NAME}:${DCMERGE_IMAGE_VERSION}
|
DCMERGE_IMAGE_FULLY_QUALIFIED=${DCMERGE_IMAGE_REGISTRY_NAME}/${DCMERGE_IMAGE_NAMESPACE}/${DCMERGE_IMAGE_NAME}:${DCMERGE_IMAGE_VERSION}
|
||||||
|
DCMERGE_IMAGE_UNQUALIFIED=${DCMERGE_IMAGE_NAMESPACE}/${DCMERGE_IMAGE_NAME}:${DCMERGE_IMAGE_VERSION}
|
||||||
|
|
||||||
# BIN
|
# BIN
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
dcmerge:
|
dcmerge:
|
||||||
CGO_ENABLED=0 \
|
CGO_ENABLED=0 \
|
||||||
|
GOPRIVATE=$(shell go env GOPRIVATE) \
|
||||||
GOPROXY=$(shell go env GOPROXY) \
|
GOPROXY=$(shell go env GOPROXY) \
|
||||||
|
GONOPROXY=$(shell go env GONOPROXY) \
|
||||||
|
GONOSUMDB=$(shell go env GONOSUMDB) \
|
||||||
|
GOSUMDB=$(shell go env GOSUMDB) \
|
||||||
go build -ldflags "-X 'main.version=${VERSION}'" -o ${@} main.go
|
go build -ldflags "-X 'main.version=${VERSION}'" -o ${@} main.go
|
||||||
|
|
||||||
# CLEAN
|
# CLEAN
|
||||||
@ -38,21 +43,15 @@ clean:
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=test/unit
|
PHONY+=test/unit
|
||||||
test/unit:
|
test/unit:
|
||||||
CGO_ENABLED=0 \
|
go test -v -p 1 -coverprofile=coverage.txt -covermode=count -timeout 1200s ./pkg/...
|
||||||
GOPROXY=$(shell go env GOPROXY) \
|
|
||||||
go test -v -p 1 -coverprofile=coverage.txt -covermode=count -timeout 1200s ./pkg/...
|
|
||||||
|
|
||||||
PHONY+=test/integration
|
PHONY+=test/integration
|
||||||
test/integration:
|
test/integration:
|
||||||
CGO_ENABLED=0 \
|
go test -v -p 1 -count=1 -timeout 1200s ./it/...
|
||||||
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 \
|
go tool cover -html=coverage.txt
|
||||||
GOPROXY=$(shell go env GOPROXY) \
|
|
||||||
go tool cover -html=coverage.txt
|
|
||||||
|
|
||||||
# GOLANGCI-LINT
|
# GOLANGCI-LINT
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
@ -92,13 +91,14 @@ container-image/build:
|
|||||||
--no-cache \
|
--no-cache \
|
||||||
--pull \
|
--pull \
|
||||||
--tag ${DCMERGE_IMAGE_FULLY_QUALIFIED} \
|
--tag ${DCMERGE_IMAGE_FULLY_QUALIFIED} \
|
||||||
|
--tag ${DCMERGE_IMAGE_UNQUALIFIED} \
|
||||||
.
|
.
|
||||||
|
|
||||||
# DELETE CONTAINER IMAGE
|
# DELETE CONTAINER IMAGE
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY:=container-image/delete
|
PHONY:=container-image/delete
|
||||||
container-image/delete:
|
container-image/delete:
|
||||||
- ${CONTAINER_RUNTIME} image rm ${DCMERGE_IMAGE_FULLY_QUALIFIED}
|
- ${CONTAINER_RUNTIME} image rm ${DCMERGE_IMAGE_FULLY_QUALIFIED} ${DCMERGE_IMAGE_UNQUALIFIED}
|
||||||
|
|
||||||
# PUSH CONTAINER IMAGE
|
# PUSH CONTAINER IMAGE
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# dcmerge
|
# dcmerge
|
||||||
|
|
||||||
|
[](https://drone.cryptic.systems/volker.raschek/dcmerge)
|
||||||
[](https://hub.docker.com/r/volkerraschek/dcmerge)
|
[](https://hub.docker.com/r/volkerraschek/dcmerge)
|
||||||
|
|
||||||
`dcmerge` is a small program to merge docker-compose files from multiple sources. It is available via RPM and docker.
|
`dcmerge` is a small program to merge docker-compose files from multiple sources. It is available via RPM and docker.
|
||||||
|
24
cmd/root.go
24
cmd/root.go
@ -19,18 +19,16 @@ func Execute(version string) error {
|
|||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
|
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
|
||||||
Args: cobra.MatchAll(cobra.ExactArgs(1)),
|
Args: cobra.MatchAll(cobra.ExactArgs(1)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
switch args[0] {
|
switch args[0] {
|
||||||
case "bash":
|
case "bash":
|
||||||
return cmd.Root().GenBashCompletion(os.Stdout)
|
cmd.Root().GenBashCompletion(os.Stdout)
|
||||||
case "zsh":
|
case "zsh":
|
||||||
return cmd.Root().GenZshCompletion(os.Stdout)
|
cmd.Root().GenZshCompletion(os.Stdout)
|
||||||
case "fish":
|
case "fish":
|
||||||
return cmd.Root().GenFishCompletion(os.Stdout, true)
|
cmd.Root().GenFishCompletion(os.Stdout, true)
|
||||||
case "powershell":
|
case "powershell":
|
||||||
return cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout)
|
cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout)
|
||||||
default:
|
|
||||||
return fmt.Errorf("unknown shell: %v", args[0])
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -55,17 +53,17 @@ dcmerge docker-compose.yml https://git.example.local/user/repo/docker-compose.ym
|
|||||||
func run(cmd *cobra.Command, args []string) error {
|
func run(cmd *cobra.Command, args []string) error {
|
||||||
mergeExisting, err := cmd.Flags().GetBool("existing-win")
|
mergeExisting, err := cmd.Flags().GetBool("existing-win")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to parse flag last-win: %s", err)
|
return fmt.Errorf("Failed to parse flag last-win: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mergeLastWin, err := cmd.Flags().GetBool("last-win")
|
mergeLastWin, err := cmd.Flags().GetBool("last-win")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to parse flag last-win: %s", err)
|
return fmt.Errorf("Failed to parse flag last-win: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
outputFile, err := cmd.Flags().GetString("output-file")
|
outputFile, err := cmd.Flags().GetString("output-file")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to parse flag output-file: %s", err)
|
return fmt.Errorf("Failed to parse flag output-file: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
dockerComposeConfig := dockerCompose.NewConfig()
|
dockerComposeConfig := dockerCompose.NewConfig()
|
||||||
@ -78,7 +76,7 @@ func run(cmd *cobra.Command, args []string) error {
|
|||||||
for _, config := range dockerComposeConfigs {
|
for _, config := range dockerComposeConfigs {
|
||||||
switch {
|
switch {
|
||||||
case mergeExisting && mergeLastWin:
|
case mergeExisting && mergeLastWin:
|
||||||
return fmt.Errorf("neither --first-win or --last-win can be specified - not booth")
|
return fmt.Errorf("Neither --first-win or --last-win can be specified - not booth.")
|
||||||
case mergeExisting && !mergeLastWin:
|
case mergeExisting && !mergeLastWin:
|
||||||
dockerComposeConfig.MergeExistingWin(config)
|
dockerComposeConfig.MergeExistingWin(config)
|
||||||
case !mergeExisting && mergeLastWin:
|
case !mergeExisting && mergeLastWin:
|
||||||
@ -90,18 +88,16 @@ func run(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
switch {
|
switch {
|
||||||
case len(outputFile) > 0:
|
case len(outputFile) > 0:
|
||||||
// #nosec G301
|
|
||||||
err = os.MkdirAll(filepath.Dir(outputFile), 0755)
|
err = os.MkdirAll(filepath.Dir(outputFile), 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// #nosec G304
|
|
||||||
f, err := os.Create(outputFile)
|
f, err := os.Create(outputFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer func() { _ = f.Close() }()
|
defer f.Close()
|
||||||
|
|
||||||
yamlEncoder := yaml.NewEncoder(f)
|
yamlEncoder := yaml.NewEncoder(f)
|
||||||
yamlEncoder.SetIndent(2)
|
yamlEncoder.SetIndent(2)
|
||||||
|
2
go.mod
2
go.mod
@ -4,7 +4,7 @@ go 1.20
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/spf13/cobra v1.9.1
|
github.com/spf13/cobra v1.9.1
|
||||||
github.com/stretchr/testify v1.11.0
|
github.com/stretchr/testify v1.10.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
4
go.sum
4
go.sum
@ -10,8 +10,8 @@ github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
|
|||||||
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
|
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
|
||||||
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
|
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
|
||||||
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/stretchr/testify v1.11.0 h1:ib4sjIrwZKxE5u/Japgo/7SJV3PvgjGiRNAvTVGqQl8=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.11.0/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
2
main.go
2
main.go
@ -5,5 +5,5 @@ import "git.cryptic.systems/volker.raschek/dcmerge/cmd"
|
|||||||
var version string
|
var version string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
_ = cmd.Execute(version)
|
cmd.Execute(version)
|
||||||
}
|
}
|
||||||
|
20
manifest.tmpl
Normal file
20
manifest.tmpl
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
image: git.cryptic.systems/volker.raschek/dcmerge:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
{{#if build.tags}}
|
||||||
|
tags:
|
||||||
|
{{#each build.tags}}
|
||||||
|
- {{this}}
|
||||||
|
{{/each}}
|
||||||
|
- "latest"
|
||||||
|
{{/if}}
|
||||||
|
manifests:
|
||||||
|
-
|
||||||
|
image: git.cryptic.systems/volker.raschek/dcmerge:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
||||||
|
-
|
||||||
|
image: git.cryptic.systems/volker.raschek/dcmerge:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}-arm64-v8
|
||||||
|
platform:
|
||||||
|
architecture: arm64
|
||||||
|
os: linux
|
||||||
|
variant: v8
|
@ -531,7 +531,6 @@ func NewSecret() *Secret {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
Command []string `json:"command,omitempty" yaml:"command,omitempty"`
|
|
||||||
CapabilitiesAdd []string `json:"cap_add,omitempty" yaml:"cap_add,omitempty"`
|
CapabilitiesAdd []string `json:"cap_add,omitempty" yaml:"cap_add,omitempty"`
|
||||||
CapabilitiesDrop []string `json:"cap_drop,omitempty" yaml:"cap_drop,omitempty"`
|
CapabilitiesDrop []string `json:"cap_drop,omitempty" yaml:"cap_drop,omitempty"`
|
||||||
DependsOnContainer *DependsOnContainer `json:"depends_on,omitempty" yaml:"depends_on,omitempty"`
|
DependsOnContainer *DependsOnContainer `json:"depends_on,omitempty" yaml:"depends_on,omitempty"`
|
||||||
@ -642,8 +641,7 @@ func (s *Service) Equal(equalable Equalable) bool {
|
|||||||
case s == nil && service != nil:
|
case s == nil && service != nil:
|
||||||
return false
|
return false
|
||||||
default:
|
default:
|
||||||
return equalSlice(s.Command, service.Command) &&
|
return equalSlice(s.CapabilitiesAdd, service.CapabilitiesAdd) &&
|
||||||
equalSlice(s.CapabilitiesAdd, service.CapabilitiesAdd) &&
|
|
||||||
equalSlice(s.CapabilitiesDrop, service.CapabilitiesDrop) &&
|
equalSlice(s.CapabilitiesDrop, service.CapabilitiesDrop) &&
|
||||||
s.DependsOnContainer.Equal(service.DependsOnContainer) &&
|
s.DependsOnContainer.Equal(service.DependsOnContainer) &&
|
||||||
s.Deploy.Equal(service.Deploy) &&
|
s.Deploy.Equal(service.Deploy) &&
|
||||||
@ -675,7 +673,6 @@ func (s *Service) MergeExistingWin(service *Service) {
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
default:
|
default:
|
||||||
s.mergeExistingWinCommand(service.Command)
|
|
||||||
s.mergeExistingWinCapabilitiesAdd(service.CapabilitiesAdd)
|
s.mergeExistingWinCapabilitiesAdd(service.CapabilitiesAdd)
|
||||||
s.mergeExistingWinCapabilitiesDrop(service.CapabilitiesDrop)
|
s.mergeExistingWinCapabilitiesDrop(service.CapabilitiesDrop)
|
||||||
s.mergeExistingWinDependsOnContainer(service.DependsOnContainer)
|
s.mergeExistingWinDependsOnContainer(service.DependsOnContainer)
|
||||||
@ -710,7 +707,6 @@ func (s *Service) MergeLastWin(service *Service) {
|
|||||||
// fallthrough
|
// fallthrough
|
||||||
|
|
||||||
default:
|
default:
|
||||||
s.mergeLastWinCommand(service.Command)
|
|
||||||
s.mergeLastWinCapabilitiesAdd(service.CapabilitiesAdd)
|
s.mergeLastWinCapabilitiesAdd(service.CapabilitiesAdd)
|
||||||
s.mergeLastWinCapabilitiesDrop(service.CapabilitiesDrop)
|
s.mergeLastWinCapabilitiesDrop(service.CapabilitiesDrop)
|
||||||
s.mergeLastWinDependsOnContainer(service.DependsOnContainer)
|
s.mergeLastWinDependsOnContainer(service.DependsOnContainer)
|
||||||
@ -727,13 +723,6 @@ func (s *Service) MergeLastWin(service *Service) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeExistingWinCommand(command []string) {
|
|
||||||
if len(s.Command) > 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
s.Command = command
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Service) mergeExistingWinCapabilitiesAdd(capabilitiesAdd []string) {
|
func (s *Service) mergeExistingWinCapabilitiesAdd(capabilitiesAdd []string) {
|
||||||
for _, capabilityAdd := range capabilitiesAdd {
|
for _, capabilityAdd := range capabilitiesAdd {
|
||||||
if !existsInSlice(s.CapabilitiesAdd, capabilityAdd) && len(capabilityAdd) > 0 {
|
if !existsInSlice(s.CapabilitiesAdd, capabilityAdd) && len(capabilityAdd) > 0 {
|
||||||
@ -946,12 +935,6 @@ func (s *Service) mergeExistingWinVolumes(volumes []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) mergeLastWinCommand(command []string) {
|
|
||||||
if len(command) > 0 {
|
|
||||||
s.Command = command
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Service) mergeLastWinCapabilitiesAdd(capabilitiesAdd []string) {
|
func (s *Service) mergeLastWinCapabilitiesAdd(capabilitiesAdd []string) {
|
||||||
for _, capabilityAdd := range capabilitiesAdd {
|
for _, capabilityAdd := range capabilitiesAdd {
|
||||||
if len(capabilityAdd) <= 0 {
|
if len(capabilityAdd) <= 0 {
|
||||||
@ -1305,8 +1288,8 @@ func (sdoc *DependsOnContainer) Equal(equalable Equalable) bool {
|
|||||||
|
|
||||||
// MarshalYAML implements the MarshalYAML interface to customize the behavior when being marshaled into a YAML document.
|
// MarshalYAML implements the MarshalYAML interface to customize the behavior when being marshaled into a YAML document.
|
||||||
func (sdoc *DependsOnContainer) MarshalYAML() (interface{}, error) {
|
func (sdoc *DependsOnContainer) MarshalYAML() (interface{}, error) {
|
||||||
var foundAnotherCondition = false
|
var foundAnotherCondition bool = false
|
||||||
var dependencyNames = make([]string, 0)
|
var dependencyNames []string
|
||||||
|
|
||||||
for dependencyName, dependencyDefinition := range sdoc.DependsOn {
|
for dependencyName, dependencyDefinition := range sdoc.DependsOn {
|
||||||
if dependencyDefinition.Condition == ServiceDependsOnConditionServiceStarted {
|
if dependencyDefinition.Condition == ServiceDependsOnConditionServiceStarted {
|
||||||
|
@ -301,7 +301,6 @@ func TestService_Equal(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
equalableA: &dockerCompose.Service{
|
equalableA: &dockerCompose.Service{
|
||||||
Command: []string{},
|
|
||||||
CapabilitiesAdd: []string{},
|
CapabilitiesAdd: []string{},
|
||||||
CapabilitiesDrop: []string{},
|
CapabilitiesDrop: []string{},
|
||||||
DependsOnContainer: &dockerCompose.DependsOnContainer{},
|
DependsOnContainer: &dockerCompose.DependsOnContainer{},
|
||||||
@ -317,7 +316,6 @@ func TestService_Equal(t *testing.T) {
|
|||||||
Volumes: []string{},
|
Volumes: []string{},
|
||||||
},
|
},
|
||||||
equalableB: &dockerCompose.Service{
|
equalableB: &dockerCompose.Service{
|
||||||
Command: []string{},
|
|
||||||
CapabilitiesAdd: []string{},
|
CapabilitiesAdd: []string{},
|
||||||
CapabilitiesDrop: []string{},
|
CapabilitiesDrop: []string{},
|
||||||
DependsOnContainer: &dockerCompose.DependsOnContainer{},
|
DependsOnContainer: &dockerCompose.DependsOnContainer{},
|
||||||
@ -334,15 +332,6 @@ func TestService_Equal(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expectedResult: true,
|
expectedResult: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
equalableA: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
equalableB: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
expectedResult: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
equalableA: &dockerCompose.Service{
|
equalableA: &dockerCompose.Service{
|
||||||
CapabilitiesAdd: []string{"NET_ADMIN"},
|
CapabilitiesAdd: []string{"NET_ADMIN"},
|
||||||
@ -647,52 +636,6 @@ func TestService_MergeExistingWin(t *testing.T) {
|
|||||||
expectedService: &dockerCompose.Service{},
|
expectedService: &dockerCompose.Service{},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Command
|
|
||||||
{
|
|
||||||
serviceDeploymentA: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
serviceDeploymentB: &dockerCompose.Service{
|
|
||||||
Command: []string{},
|
|
||||||
},
|
|
||||||
expectedService: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
serviceDeploymentA: &dockerCompose.Service{
|
|
||||||
Command: []string{},
|
|
||||||
},
|
|
||||||
serviceDeploymentB: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
expectedService: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
serviceDeploymentA: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
serviceDeploymentB: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
expectedService: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
serviceDeploymentA: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
serviceDeploymentB: &dockerCompose.Service{
|
|
||||||
Command: []string{""},
|
|
||||||
},
|
|
||||||
expectedService: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// CapabilitiesAdd
|
// CapabilitiesAdd
|
||||||
{
|
{
|
||||||
serviceDeploymentA: &dockerCompose.Service{
|
serviceDeploymentA: &dockerCompose.Service{
|
||||||
@ -1677,52 +1620,6 @@ func TestService_MergeLastWin(t *testing.T) {
|
|||||||
expectedService: &dockerCompose.Service{},
|
expectedService: &dockerCompose.Service{},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Command
|
|
||||||
{
|
|
||||||
serviceDeploymentA: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
serviceDeploymentB: &dockerCompose.Service{
|
|
||||||
Command: []string{},
|
|
||||||
},
|
|
||||||
expectedService: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
serviceDeploymentA: &dockerCompose.Service{
|
|
||||||
Command: []string{},
|
|
||||||
},
|
|
||||||
serviceDeploymentB: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
expectedService: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
serviceDeploymentA: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
serviceDeploymentB: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
expectedService: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
serviceDeploymentA: &dockerCompose.Service{
|
|
||||||
Command: []string{"/usr/bin/cp", "--recursive", "/tmp/foo.txt", "/tmp/bar.txt"},
|
|
||||||
},
|
|
||||||
serviceDeploymentB: &dockerCompose.Service{
|
|
||||||
Command: []string{""},
|
|
||||||
},
|
|
||||||
expectedService: &dockerCompose.Service{
|
|
||||||
Command: []string{""},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// CapabilitiesAdd
|
// CapabilitiesAdd
|
||||||
{
|
{
|
||||||
serviceDeploymentA: &dockerCompose.Service{
|
serviceDeploymentA: &dockerCompose.Service{
|
||||||
|
@ -55,8 +55,8 @@ func EqualStringMap[R Equalable](mapA, mapB map[string]R) bool {
|
|||||||
|
|
||||||
// ExistsInMap returns true if object of type any exists under the passed name.
|
// ExistsInMap returns true if object of type any exists under the passed name.
|
||||||
func ExistsInMap[T any](m map[string]T, name string) bool {
|
func ExistsInMap[T any](m map[string]T, name string) bool {
|
||||||
switch m {
|
switch {
|
||||||
case nil:
|
case m == nil:
|
||||||
return false
|
return false
|
||||||
default:
|
default:
|
||||||
_, present := m[name]
|
_, present := m[name]
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
services:
|
|
||||||
frontend:
|
|
||||||
command: [ "/usr/bin/cp", "--recursive", "--force", "/tmp/foo.txt", "/tmp/bar.txt" ]
|
|
||||||
image: library/frontend:latest
|
|
@ -1,4 +0,0 @@
|
|||||||
services:
|
|
||||||
frontend:
|
|
||||||
command: [ "/usr/bin/cp", "--recursive", "--force", "/tmp/bar.txt", "/tmp/foo.txt"]
|
|
||||||
image: library/frontend:latest
|
|
@ -1,9 +0,0 @@
|
|||||||
services:
|
|
||||||
frontend:
|
|
||||||
command:
|
|
||||||
- /usr/bin/cp
|
|
||||||
- --recursive
|
|
||||||
- --force
|
|
||||||
- /tmp/foo.txt
|
|
||||||
- /tmp/bar.txt
|
|
||||||
image: library/frontend:latest
|
|
@ -20,15 +20,15 @@ func Fetch(urls ...string) ([]*dockerCompose.Config, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
switch dockerComposeURL.Scheme {
|
switch {
|
||||||
case "http", "https":
|
case dockerComposeURL.Scheme == "http" || dockerComposeURL.Scheme == "https":
|
||||||
dockerComposeConfig, err := getDockerComposeViaHTTP(dockerComposeURL.String())
|
dockerComposeConfig, err := getDockerComposeViaHTTP(dockerComposeURL.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
dockerComposeConfigs = append(dockerComposeConfigs, dockerComposeConfig)
|
dockerComposeConfigs = append(dockerComposeConfigs, dockerComposeConfig)
|
||||||
case "file":
|
case dockerComposeURL.Scheme == "file":
|
||||||
fallthrough
|
fallthrough
|
||||||
default:
|
default:
|
||||||
dockerComposeConfig, err := readDockerComposeFromFile(dockerComposeURL.Path)
|
dockerComposeConfig, err := readDockerComposeFromFile(dockerComposeURL.Path)
|
||||||
@ -43,7 +43,7 @@ func Fetch(urls ...string) ([]*dockerCompose.Config, error) {
|
|||||||
return dockerComposeConfigs, nil
|
return dockerComposeConfigs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var ErrPathIsDir error = errors.New("path is a directory")
|
var ErrorPathIsDir error = errors.New("Path is a directory")
|
||||||
|
|
||||||
func getDockerComposeViaHTTP(url string) (*dockerCompose.Config, error) {
|
func getDockerComposeViaHTTP(url string) (*dockerCompose.Config, error) {
|
||||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||||
@ -55,10 +55,10 @@ func getDockerComposeViaHTTP(url string) (*dockerCompose.Config, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer func() { _ = resp.Body.Close() }()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
return nil, fmt.Errorf("received unexpected HTTP-Statuscode %v", resp.StatusCode)
|
return nil, fmt.Errorf("Received unexpected HTTP-Statuscode %v", resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
dockerCompose := dockerCompose.NewConfig()
|
dockerCompose := dockerCompose.NewConfig()
|
||||||
@ -78,15 +78,14 @@ func readDockerComposeFromFile(name string) (*dockerCompose.Config, error) {
|
|||||||
case err != nil:
|
case err != nil:
|
||||||
return nil, err
|
return nil, err
|
||||||
case fileStat.IsDir():
|
case fileStat.IsDir():
|
||||||
return nil, fmt.Errorf("%w: %s", ErrPathIsDir, name)
|
return nil, fmt.Errorf("%w: %s", ErrorPathIsDir, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// #nosec G304
|
|
||||||
file, err := os.Open(name)
|
file, err := os.Open(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer func() { _ = file.Close() }()
|
defer file.Close()
|
||||||
|
|
||||||
dockerCompose := dockerCompose.NewConfig()
|
dockerCompose := dockerCompose.NewConfig()
|
||||||
|
|
||||||
|
@ -1,10 +1,41 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": [
|
"assignees": [ "volker.raschek" ],
|
||||||
"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",
|
"addLabels": [ "renovate/droneci", "renovate/automerge" ],
|
||||||
"local>volker.raschek/renovate-config:regexp#master"
|
"automerge": true,
|
||||||
]
|
"matchManagers": "droneci",
|
||||||
|
"matchUpdateTypes": [ "minor", "patch"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Automatically update patch version of used container images in docker files",
|
||||||
|
"addLabels": [ "renovate/container-image", "renovate/automerge" ],
|
||||||
|
"automerge": true,
|
||||||
|
"matchBaseBranches": [ "master" ],
|
||||||
|
"matchManagers": [ "dockerfile" ],
|
||||||
|
"matchUpdateTypes": [ "minor", "patch" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Automatically update minor and patch versions of go modules",
|
||||||
|
"addLabels": [ "renovate/gomod", "renovate/automerge" ],
|
||||||
|
"automerge": true,
|
||||||
|
"matchManagers": [ "gomod" ],
|
||||||
|
"matchUpdateTypes": [ "minor", "patch" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Disable major update version of go modules",
|
||||||
|
"enabled": false,
|
||||||
|
"matchManagers": [ "gomod" ],
|
||||||
|
"matchPackageNames": [
|
||||||
|
"gopkg.in/yaml.v2"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"postUpdateOptions": [
|
||||||
|
"gomodTidy"
|
||||||
|
],
|
||||||
|
"rebaseLabel": "renovate/rebase",
|
||||||
|
"rebaseWhen": "behind-base-branch"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user