123 Commits

Author SHA1 Message Date
63a54e130d chore(ci): use goreleaser
Some checks failed
Release / release (push) Successful in 6m4s
Release / sync-container-image (push) Failing after 33s
2025-04-14 19:07:10 +02:00
ef1c7f25a3 chore(deps): update container images
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-04-01 19:11:19 +00:00
cc9c98b84d chore(renovate): use configuration preset
All checks were successful
continuous-integration/drone/push Build is passing
2025-03-30 22:46:31 +02:00
9f29df1311 chore(deps): update docker.io/plugins/docker docker tag to v20.18.8
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-03-26 20:10:46 +00:00
1d8a8d7b76 Merge pull request 'chore(deps): update docker.io/library/golang docker tag to v1.24.1' (#74) from renovate/docker.io-library-golang-1.x into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #74
2025-03-22 17:01:14 +00:00
3e73692f28 chore(deps): update docker.io/library/golang docker tag to v1.24.1
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is passing
2025-03-22 15:29:22 +00:00
7a0c89c8b7 chore(renovate): remove obsolete matchBaseBranches
All checks were successful
continuous-integration/drone/push Build is passing
2025-03-22 15:10:00 +00:00
3c56ae6e5e fix(docker-compose): extend YAML marshaler of service.dependsOn
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
The current implementation of the method DependsOnContainer.MarshalYAML()
transform the short syntax into the long syntax. More about booth version
types of depends_on is described here:

- https://docs.docker.com/reference/compose-file/services/#short-syntax-1
- https://docs.docker.com/reference/compose-file/services/#long-syntax-1

Other applications are not compatible with the long syntax. For this reason the
MarshalYAML method has been adapted to take care of the specific syntax.

As documented of the long syntax, `depends_on.<dependency>.condition: service_started`
is the same as `depends_on: [ 'dependency' ]`, the long syntax will be shortened
when no other condition type of a dependency is specified.
2025-03-04 17:50:01 +01:00
ed7622a34f chore(coverage): ignore coverage.txt 2025-03-04 17:50:01 +01:00
967c20c638 fix(cmd): replace deprecated cobra function 2025-03-04 17:50:01 +01:00
c23633a385 chore(deps): update quay.io/skopeo/stable docker tag to v1.18.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-02-28 17:10:07 +00:00
68db80a05a fix(yaml): set indentation to 2 spaces
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
The replaced module gopkg.in/yaml.v3 enforce an indentation of 4 spaces, when 0
spaces are defined. This is sad, because the old behavior can not be reproduced.

Instead of using 4 spaces for indentation, when `yamlEncoder.SetIndent(0)` is
called, we call `yamlEncoder.SetIndent(2)` to use 2 spaces for indentation,
because it is closer to 0 instead 4 spaces.
2025-02-25 16:35:44 +01:00
6761dbf419 test(docker-compose): add further tests regrading depends_on
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-02-25 16:21:13 +01:00
ab282e5173 feat: support depends_on
All checks were successful
continuous-integration/drone/push Build is passing
This PR supports the extended pattern of `depends_on`. If the short version of
`depends_on` is defined, it will be migrated to the extended version like the
example below:

```yaml
services:
  web:
    depends_on
    - database

services:
  web:
    depends_on:
      database:
        condition: service_started
```

All three types of merging strategies are supported.
2025-02-24 22:44:11 +01:00
003db26fe5 feat: respect individual ports instead of replacing the entire slice of ports
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
The following patch adapts the logic of the merge strategy existing and last
win for service ports.

In the past, the complete object has been replaced based on the merge strategy.
This behavior has been adapted, that each port should now considered
individually per strategy.

Both strategies now focus on the src port of the host system. With a last-win,
the dest port of the container is overwritten with an existing src port.

```diff
  service:
    my-app:
      ports:
- - 0.0.0.0:8080:80
+ - 0.0.0.0:8080:8080
      - 0.0.0.0:8443:8443
```

The situation is different with the existing win strategy. There, the destination
port can no longer be changed once there is a connection with a sourc port.
2025-02-21 13:55:53 +01:00
f8b4fe9af6 fix(dockerCompoe): compare srcIP and srcPort of mergeExistingWinPorts() 2025-02-21 09:51:53 +01:00
2c91222753 chore(renovate): disable go package gopkg.in/yaml.v2
All checks were successful
continuous-integration/drone/push Build is passing
2025-02-20 17:29:39 +01:00
b45f8181aa style(lint): block unused parameter
All checks were successful
continuous-integration/drone/push Build is passing
2025-02-20 17:26:43 +01:00
13301cb367 fix(dockerCompose): add further methods of port
This patch adds the following methods:

ports.ExistsDstIP()
ports.ExistsDstPort()
ports.ExistsProtocol()
ports.ExistsSrcIP()
ports.ExistsSrcPort()
ports.GetDstIP()
ports.GetDstPort()
ports.GetProtocol()
ports.GetSrcIP()
ports.GetSrcPort()
2025-02-20 17:26:43 +01:00
0a68b2d8e7 fix(dockerCompose): add port.ExistProtocol 2025-02-20 17:26:43 +01:00
54af4469a4 chore(deps): update docker.io/plugins/docker docker tag to v20.18.7
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-02-18 08:08:41 +00:00
dc15512229 chore(deps): update module github.com/spf13/cobra to v1.9.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-02-17 02:10:59 +00:00
5fa0991bc2 chore(deps): update docker.io/library/golang docker tag to v1.24.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-02-15 23:09:33 +00:00
efb5fba9a9 chore(deps): update module github.com/spf13/cobra to v1.9.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-02-15 20:12:23 +00:00
c8894de28c chore(deps): update docker.io/library/golang docker tag to v1.23.6
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-02-05 23:22:50 +00:00
da34769ff3 chore(deps): update docker.io/library/golang docker tag to v1.23.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-01-17 02:09:57 +00:00
1a9fa39c94 chore(deps): update docker.io/plugins/docker docker tag to v20.18.6
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-25 05:07:40 +00:00
554c73bd7b chore(deps): update docker.io/library/golang docker tag to v1.23.4
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-06 05:06:28 +00:00
ea0bb14ac4 chore(deps): update docker.io/library/alpine docker tag to v3.21
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-05 23:07:30 +00:00
20b4f12dd1 chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.43.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-12-03 14:10:12 +00:00
f2dc3d5174 fix(fetcher): handle all os.Stat() errors
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2024-12-03 11:09:38 +01:00
37de3302c6 chore(deps): update docker.io/plugins/docker docker tag to v20.18.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-29 11:08:17 +00:00
57dff5ff36 chore(deps): update git.cryptic.systems/volker.raschek/git docker tag to v1.4.0
Some checks reported errors
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build encountered an error
2024-11-25 23:08:50 +00:00
f0f5e586d9 chore(deps): update module github.com/stretchr/testify to v1.10.0
Some checks reported errors
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build encountered an error
2024-11-23 14:06:33 +00:00
0cd81642bb chore(deps): update quay.io/skopeo/stable docker tag to v1.17.0
Some checks reported errors
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build encountered an error
2024-11-21 17:08:04 +00:00
e6e3b0d4fc chore(deps): update docker.io/library/golang docker tag to v1.23.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-07 08:06:11 +00:00
e66b2045f2 chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.42.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-14 19:09:18 +00:00
141779c2a0 chore(deps): update docker.io/library/golang docker tag to v1.23.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-02 01:07:01 +00:00
c2ad246c32 chore(deps): update docker.io/library/golang docker tag to v1.23.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-09-06 01:06:09 +00:00
e1a7f3b900 chore(deps): update quay.io/skopeo/stable docker tag to v1.16.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-09-03 16:06:24 +00:00
5417844dcc chore(deps): update docker.io/plugins/docker docker tag to v20.18.4
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-08-22 16:06:40 +00:00
63030b3523 chore(deps): update docker.io/library/golang docker tag to v1.23.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-08-18 19:08:04 +00:00
168026c4ac chore(deps): update quay.io/skopeo/stable docker tag to v1.16.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-08-18 16:07:00 +00:00
992941abdc chore(deps): update docker.io/plugins/docker docker tag to v20.18.3
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2024-07-26 12:03:46 +00:00
e8093e7266 chore(deps): update docker.io/plugins/docker docker tag to v20.18.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-23 19:09:28 +00:00
a04c5f9606 chore(deps): update quay.io/skopeo/stable docker tag to v1.15.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-16 16:05:39 +00:00
7edd465bc6 chore(deps): update docker.io/plugins/docker docker tag to v20.18.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-15 22:07:28 +00:00
c62c747551 chore(deps): update quay.io/skopeo/stable docker tag to v1.15.1
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2024-07-13 22:04:55 +00:00
900e5535ed chore(deps): update module github.com/spf13/cobra to v1.8.1
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-13 20:04:40 +00:00
dc329229e1 chore(deps): update docker.io/library/golang docker tag to v1.22.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-13 19:06:30 +00:00
49b1cfb1fe chore(deps): update docker.io/plugins/docker docker tag to v20.18.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-07-13 10:54:03 +00:00
910172cc94 chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.41.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-27 13:09:43 +00:00
04455e02b4 chore(deps): update docker.io/library/alpine docker tag to v3.20
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-22 19:05:46 +00:00
e2c38f76b7 chore(deps): update docker.io/plugins/docker docker tag to v20.17.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-20 13:08:10 +00:00
4c67cb4198 chore(deps): update docker.io/plugins/docker docker tag to v20.17.4
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-13 10:05:49 +00:00
5c3ba383b6 chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.40.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-05-07 22:12:31 +00:00
bbade1e4f9 chore(deps): update docker.io/library/golang docker tag to v1.22.3
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2024-05-07 19:05:10 +00:00
4085619557 chore(deps): update docker.io/library/golang docker tag to v1.22.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-04-03 19:43:35 +00:00
a1b8695aae chore(deps): update quay.io/skopeo/stable docker tag to v1.15.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-03-31 16:06:08 +00:00
934997b20a chore(deps): update docker.io/plugins/docker docker tag to v20.17.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-03-11 08:06:06 +00:00
702c1ac4b6 chore(deps): update docker.io/library/golang docker tag to v1.22.1
Some checks reported errors
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build was killed
2024-03-05 20:04:44 +00:00
ea5269027d chore(deps): update module github.com/stretchr/testify to v1.9.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-03-02 14:04:47 +00:00
6ced20b951 fix(ci): update renovate config
All checks were successful
continuous-integration/drone/push Build is passing
2024-03-02 13:42:00 +01:00
a6b4fd0afc chore(deps): update quay.io/skopeo/stable docker tag to v1.14.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-02-18 17:05:17 +00:00
07288bf752 chore(deps): update docker.io/library/golang docker tag to v1.22.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-02-07 05:03:55 +00:00
e09eaebfb3 chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.39.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-28 23:05:04 +00:00
6224a9d38f chore(deps): update docker.io/library/alpine docker tag to v3.19.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-01-27 02:03:49 +00:00
2da0b01a44 fix(renovate): remove automerge options
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-21 15:03:05 +01:00
7628004096 Merge pull request 'chore(deps): update docker.io/plugins/docker docker tag to v20.17.2' (#27) from renovate/docker.io-plugins-docker-20.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-10 17:15:47 +00:00
19f70937e9 chore(deps): update docker.io/plugins/docker docker tag to v20.17.2
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2024-01-10 17:05:37 +00:00
d8e064d873 Merge pull request 'chore(deps): update docker.io/library/golang docker tag to v1.21.6' (#26) from renovate/docker.io-library-golang-1.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-09 23:16:54 +00:00
7cb4c5634c chore(deps): update docker.io/library/golang docker tag to v1.21.6
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2024-01-09 23:04:40 +00:00
86695b62ec Merge pull request 'chore(deps): update docker.io/library/alpine docker tag to v3.19.0' (#24) from renovate/docker.io-library-alpine-3.x into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #24
2023-12-20 11:16:03 +00:00
dc861f13b1 chore(deps): update docker.io/library/alpine docker tag to v3.19.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-12-13 17:43:44 +00:00
9a3c64e91a chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.38.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-09 14:33:36 +00:00
610dd87a4b chore(deps): update quay.io/skopeo/stable docker tag to v1.14.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-06 17:17:51 +01:00
165cd6a778 chore(deps): update docker.io/library/alpine docker tag to v3.18.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-06 02:03:16 +01:00
2f9a7d0dd5 chore(deps): update docker.io/library/golang docker tag to v1.21.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-12-05 23:05:16 +00:00
b83efda648 test(assets): add depends_on as example
All checks were successful
continuous-integration/drone/push Build is passing
2023-11-25 18:21:07 +01:00
5dea30fec0 fix(domain): iterate when merging over custom configs
The normal dcmerge did not work, as the check and addition was only
possible if at least one attribute such as service, network or volume
was presentThe normal dcmerge did not work, as the check and addition
was only possible if at least one attribute such as service, network or
volume was present.

The logic was adjusted.

The logic was adjusted.
2023-11-25 18:21:07 +01:00
3d97ee0ab8 fix(lint): increase line length to 120 2023-11-25 18:21:07 +01:00
8b68c9587c feat: support depends_on 2023-11-25 18:21:07 +01:00
669ebd0f25 chore(deps): update docker.io/plugins/docker docker tag to v20.17.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-11-15 14:07:06 +00:00
8f794494a2 chore(deps): update docker.io/library/golang docker tag to v1.21.4
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-11-07 23:05:08 +00:00
8e411cc486 chore(deps): update module github.com/spf13/cobra to v1.8.0
All checks were successful
continuous-integration/drone/push Build is passing
2023-11-05 23:24:28 +01:00
d7e8970860 Merge pull request 'chore(deps): update docker.io/plugins/docker docker tag to v20.17.0' (#1) from renovate/docker.io-plugins-docker-20.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-31 02:06:11 +00:00
8603eca0b5 chore(deps): update docker.io/plugins/docker docker tag to v20.17.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-10-30 23:05:33 +00:00
d8ada5578b fix(ci): unsupport arm v7
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-30 21:32:36 +01:00
4f5d115926 chore(deps): update docker.io/library/golang docker tag to v1.21.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-11 07:49:22 +02:00
dac3be4e2d chore(deps): update docker.io/library/golang docker tag to v1.21.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-06 20:32:36 +02:00
173637693f chore(deps): update git.cryptic.systems/volker.raschek/drone-email docker tag to v0.1.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-03 19:18:35 +02:00
3ba641aa12 chore(deps): update git.cryptic.systems/volker.raschek/git docker tag to v1.3.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-10-03 10:27:29 +02:00
768a49319d chore(deps): update quay.io/skopeo/stable docker tag to v1.13.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-29 00:38:35 +02:00
66f5fff92a chore(deps): update docker.io/library/alpine docker tag to v3.18.4
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-29 00:15:33 +02:00
b6b2e069cd chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.37.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-22 19:33:41 +02:00
2c738d0417 chore(deps): update docker.io/library/golang docker tag to v1.21.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-06 21:31:18 +02:00
46dd067b48 fix(renovate): exclude updating docker.io/plugins/docker
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-03 16:37:08 +02:00
9669685997 chore(deps): update git.cryptic.systems/volker.raschek/markdownlint docker tag to v0.36.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-03 13:52:59 +02:00
9a76f3432a chore(deps): update quay.io/skopeo/stable docker tag to v1.13.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-29 22:02:10 +02:00
751bb810d2 fix(dockerCompose): protect of empty attributes 2023-08-28 11:37:24 +02:00
9b469bd8c6 fix: rename firstWin to existingWin 2023-08-28 11:13:32 +02:00
4ad9da6d63 fix(cmd): add flag first-win 2023-08-28 10:57:36 +02:00
2ea83b7591 fix(dockerCompose): add MergeFirstWin() 2023-08-28 10:57:36 +02:00
6f673e4a72 test: add example docker-compose 2023-08-28 10:57:36 +02:00
d9ecf068c9 fix(dockerCompose): add Service.MergeFirstWin() 2023-08-28 10:57:36 +02:00
4c3c6cd5d2 fix(dockerCompose): add ServiceDeploy.MergeFirstWin() 2023-08-28 10:57:36 +02:00
23290fbd5d fix(dockerCompose): add ServiceDeployResources.MergeFirstWin() 2023-08-28 10:57:36 +02:00
07673bfd53 fix(dockerCompose): add ServiceDeployResourcesLimits.MergeFirstWin() 2023-08-28 10:57:36 +02:00
405a0258f1 fix(dockerCompose): add ServiceNetwork.MergeFirstWin() 2023-08-28 10:57:36 +02:00
462299d5cd fix(dockerCompose): add ServiceUlimits.MergeFirstWin() 2023-08-28 10:57:36 +02:00
6524785871 test(dockerCompose): add ServiceUlimitsNoFile.MergeFirstWin() 2023-08-28 10:57:36 +02:00
1207bcfcab test(dockerCompose): add Volume.MergeFirstWin() 2023-08-28 10:57:36 +02:00
a656dc2db1 fix(dockerCompose): add ServiceUlimitsNoFile.MergeFirstWin() 2023-08-28 10:57:36 +02:00
14c645dd96 fix(dockerCompose): add Volume.MergeFirstWin() 2023-08-28 10:57:36 +02:00
7b0109caf4 Merge pull request 'chore(deps): update dependency docker.io/library/golang to v1.21.0' (#6) from renovate/docker.io-library-golang-1.x into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #6
2023-08-16 17:48:01 +00:00
6bfd49947e chore(deps): update dependency docker.io/library/golang to v1.21.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-08-10 15:41:23 +02:00
04e0d98dde chore(deps): update dependency docker.io/library/alpine to v3.18.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-07 23:42:48 +02:00
87ec3349ea fix(ci): execute linter and unit-test in parallel
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-02 23:26:19 +02:00
ad1cf8cbef fix(ci): execute unit tests on dry-run
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2023-08-02 23:20:38 +02:00
16f1f5e9da fix(ci): execute unit tests
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-02 23:19:08 +02:00
35d35f0b20 chore(deps): update dependency docker.io/library/golang to v1.20.7
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-08-02 00:43:07 +02:00
0375ccbf69 chore(deps): update dependency quay.io/skopeo/stable to v1.13.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-07-31 01:22:48 +02:00
ce48d6dd0c fix(dockerCompose): mergeLastWinImage
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-26 14:44:12 +02:00
30 changed files with 4125 additions and 420 deletions

View File

@ -11,12 +11,12 @@ platform:
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
image: git.cryptic.systems/volker.raschek/git:1.4.0
- name: markdown lint
commands:
- markdownlint *.md
image: git.cryptic.systems/volker.raschek/markdownlint:0.35.0
image: git.cryptic.systems/volker.raschek/markdownlint:0.44.0
resources:
limits:
cpu: 150
@ -34,7 +34,7 @@ steps:
from_secret: smtp_username
SMTP_PASSWORD:
from_secret: smtp_password
image: git.cryptic.systems/volker.raschek/drone-email:0.1.2
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
resources:
limits:
cpu: 150
@ -49,6 +49,59 @@ trigger:
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.2
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.2
trigger:
event:
include:
- pull_request
- push
exclude:
- tag
---
kind: pipeline
type: docker
@ -59,6 +112,7 @@ clone:
depends_on:
- linter
- unit-test-amd64
platform:
os: linux
@ -66,10 +120,10 @@ platform:
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
image: git.cryptic.systems/volker.raschek/git:1.4.0
- name: build
image: docker.io/plugins/docker:20.10.9
image: docker.io/plugins/docker:20.18.8
settings:
auto_tag: false
dockerfile: Dockerfile
@ -99,73 +153,7 @@ steps:
from_secret: smtp_username
SMTP_PASSWORD:
from_secret: smtp_password
image: git.cryptic.systems/volker.raschek/drone-email:0.1.2
when:
status:
- changed
- failure
trigger:
branch:
exclude:
- master
event:
- pull_request
- push
repo:
- volker.raschek/dcmerge
---
kind: pipeline
type: docker
name: dry-run-arm-v7
clone:
disable: true
depends_on:
- linter
platform:
os: linux
arch: arm
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
- name: build
image: docker.io/plugins/docker:20.10.9
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-arm-v7
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.2
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
when:
status:
- changed
@ -191,6 +179,7 @@ clone:
depends_on:
- linter
- unit-test-arm64
platform:
os: linux
@ -198,10 +187,10 @@ platform:
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
image: git.cryptic.systems/volker.raschek/git:1.4.0
- name: build
image: docker.io/plugins/docker:20.10.9
image: docker.io/plugins/docker:20.18.8
settings:
auto_tag: false
dockerfile: Dockerfile
@ -231,7 +220,7 @@ steps:
from_secret: smtp_username
SMTP_PASSWORD:
from_secret: smtp_password
image: git.cryptic.systems/volker.raschek/drone-email:0.1.2
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
when:
status:
- changed
@ -257,6 +246,7 @@ clone:
depends_on:
- linter
- unit-test-amd64
platform:
os: linux
@ -264,10 +254,10 @@ platform:
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
image: git.cryptic.systems/volker.raschek/git:1.4.0
- name: build
image: docker.io/plugins/docker:20.10.9
image: docker.io/plugins/docker:20.18.8
settings:
auto_tag: false
dockerfile: Dockerfile
@ -296,71 +286,7 @@ steps:
from_secret: smtp_username
SMTP_PASSWORD:
from_secret: smtp_password
image: git.cryptic.systems/volker.raschek/drone-email:0.1.2
when:
status:
- changed
- failure
trigger:
branch:
- master
event:
- cron
- push
repo:
- volker.raschek/dcmerge
---
kind: pipeline
type: docker
name: latest-arm-v7
clone:
disable: true
depends_on:
- linter
platform:
os: linux
arch: arm
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
- name: build
image: docker.io/plugins/docker:20.10.9
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-arm-v7
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.2
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
when:
status:
- changed
@ -385,6 +311,7 @@ clone:
depends_on:
- linter
- unit-test-arm64
platform:
os: linux
@ -392,10 +319,10 @@ platform:
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
image: git.cryptic.systems/volker.raschek/git:1.4.0
- name: build
image: docker.io/plugins/docker:20.10.9
image: docker.io/plugins/docker:20.18.8
settings:
auto_tag: false
dockerfile: Dockerfile
@ -424,7 +351,7 @@ steps:
from_secret: smtp_username
SMTP_PASSWORD:
from_secret: smtp_password
image: git.cryptic.systems/volker.raschek/drone-email:0.1.2
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
when:
status:
- changed
@ -449,7 +376,6 @@ clone:
depends_on:
- latest-amd64
- latest-arm-v7
- latest-arm64-v8
# docker.io/plugins/manifest only for amd64 architectures available
@ -459,7 +385,7 @@ node_selector:
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
image: git.cryptic.systems/volker.raschek/git:1.4.0
- name: build-manifest
image: docker.io/plugins/manifest:1.4.0
@ -484,7 +410,7 @@ steps:
from_secret: smtp_username
SMTP_PASSWORD:
from_secret: smtp_password
image: git.cryptic.systems/volker.raschek/drone-email:0.1.2
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
resources:
limits:
cpu: 150
@ -516,7 +442,7 @@ depends_on:
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
image: git.cryptic.systems/volker.raschek/git:1.4.0
- name: latest-sync
commands:
@ -530,7 +456,7 @@ steps:
from_secret: container_image_registry_user
DEST_CRED_PASSWORD:
from_secret: container_image_registry_password
image: quay.io/skopeo/stable:v1.13.0
image: quay.io/skopeo/stable:v1.18.0
- name: email-notification
environment:
@ -544,7 +470,7 @@ steps:
from_secret: smtp_username
SMTP_PASSWORD:
from_secret: smtp_password
image: git.cryptic.systems/volker.raschek/drone-email:0.1.2
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
resources:
limits:
cpu: 150
@ -577,10 +503,10 @@ platform:
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
image: git.cryptic.systems/volker.raschek/git:1.4.0
- name: build
image: docker.io/plugins/docker:20.10.9
image: docker.io/plugins/docker:20.18.8
settings:
auto_tag: true
auto_tag_suffix: amd64
@ -611,67 +537,7 @@ steps:
from_secret: smtp_username
SMTP_PASSWORD:
from_secret: smtp_password
image: git.cryptic.systems/volker.raschek/drone-email:0.1.2
when:
status:
- changed
- failure
trigger:
event:
- tag
repo:
- volker.raschek/dcmerge
---
kind: pipeline
type: docker
name: tagged-arm-v7
clone:
disable: true
platform:
os: linux
arch: arm
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
- name: build
image: docker.io/plugins/docker:20.10.9
settings:
auto_tag: true
auto_tag_suffix: arm-v7
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.2
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
when:
status:
- changed
@ -697,10 +563,10 @@ platform:
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
image: git.cryptic.systems/volker.raschek/git:1.4.0
- name: build
image: docker.io/plugins/docker:20.10.9
image: docker.io/plugins/docker:20.18.8
settings:
auto_tag: true
auto_tag_suffix: arm64-v8
@ -731,7 +597,7 @@ steps:
from_secret: smtp_username
SMTP_PASSWORD:
from_secret: smtp_password
image: git.cryptic.systems/volker.raschek/drone-email:0.1.2
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
when:
status:
- changed
@ -753,7 +619,6 @@ clone:
depends_on:
- tagged-amd64
- tagged-arm-v7
- tagged-arm64-v8
# docker.io/plugins/manifest only for amd64 architectures available
@ -763,7 +628,7 @@ node_selector:
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
image: git.cryptic.systems/volker.raschek/git:1.4.0
- name: build-manifest
image: docker.io/plugins/manifest:1.4.0
@ -788,7 +653,7 @@ steps:
from_secret: smtp_username
SMTP_PASSWORD:
from_secret: smtp_password
image: git.cryptic.systems/volker.raschek/drone-email:0.1.2
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
resources:
limits:
cpu: 150
@ -817,7 +682,7 @@ depends_on:
steps:
- name: clone
image: git.cryptic.systems/volker.raschek/git:1.2.1
image: git.cryptic.systems/volker.raschek/git:1.4.0
- name: tagged-sync
commands:
@ -831,7 +696,7 @@ steps:
from_secret: container_image_registry_user
DEST_CRED_PASSWORD:
from_secret: container_image_registry_password
image: quay.io/skopeo/stable:v1.13.0
image: quay.io/skopeo/stable:v1.18.0
- name: email-notification
environment:
@ -845,7 +710,7 @@ steps:
from_secret: smtp_username
SMTP_PASSWORD:
from_secret: smtp_password
image: git.cryptic.systems/volker.raschek/drone-email:0.1.2
image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
resources:
limits:
cpu: 150

View File

@ -0,0 +1,51 @@
name: Release
on:
push:
tags: [ "*" ]
permissions:
contents: write
jobs:
release:
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: docker/setup-qemu-action@v3.6.0
- uses: actions/setup-go@v5.4.0
with:
go-version: stable
- uses: docker/login-action@v3.4.0
with:
registry: git.cryptic.systems
username: ${{ github.repository_owner }}
password: ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }}
- env:
GITEA_TOKEN: ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }}
GONOSUMDB: ${{ vars.GONOSUMDB }}
GOPROXY: ${{ vars.GOPROXY }}
uses: goreleaser/goreleaser-action@v6.2.1
with:
version: "~> v2"
args: release --clean
sync-container-image:
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-goreleaser:${TAG} \
docker://docker.io/volkerraschek/dcmerge-goreleaser:${TAG}

3
.gitignore vendored
View File

@ -1 +1,2 @@
dcmerge
dcmerge
coverage.txt

154
.goreleaser.yaml Normal file
View File

@ -0,0 +1,154 @@
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
goarm:
- "6"
- "7"
flags:
- -trimpath
ldflags:
- -s -w -X 'main.version={{ trimprefix .Tag "v" }}'
changelog:
filters:
exclude:
- '^chore'
- '^docs'
- '^test'
- Merge pull request
- Merge branch
- go mod tidy
format: "{{.SHA}}: {{.Message}} (@{{.AuthorUsername}})"
groups:
- title: Features
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
order: 0
- title: "Bug fixes"
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
order: 1
- title: Others
order: 999
sort: asc
use: git
dockers:
- build_flag_templates:
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.documentation={{ .ProjectName }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source={{ .GitURL }}
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://git.cryptic.systems/volker.raschek/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ trimprefix .Tag "v" }}
- --platform=linux/amd64
- --pull
dockerfile: Dockerfile
goarch: amd64
goos: linux
image_templates:
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-amd64'
skip_push: false
use: buildx
- build_flag_templates:
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.documentation={{ .ProjectName }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source={{ .GitURL }}
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://git.cryptic.systems/volker.raschek/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ trimprefix .Tag "v" }}
- --platform=linux/arm/v6
- --pull
dockerfile: Dockerfile
goarch: arm
goarm: "6"
goos: linux
image_templates:
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v6'
skip_push: false
use: buildx
- build_flag_templates:
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.documentation={{ .ProjectName }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source={{ .GitURL }}
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://git.cryptic.systems/volker.raschek/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ trimprefix .Tag "v" }}
- --platform=linux/arm/v7
- --pull
dockerfile: Dockerfile
goarch: arm
goarm: "7"
goos: linux
image_templates:
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v7'
skip_push: false
use: buildx
- build_flag_templates:
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.documentation={{ .ProjectName }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.source={{ .GitURL }}
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://git.cryptic.systems/volker.raschek/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ trimprefix .Tag "v" }}
- --platform=linux/arm64
- --pull
dockerfile: Dockerfile
goarch: arm64
goos: linux
image_templates:
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm64'
skip_push: false
use: buildx
docker_manifests:
- name_template: 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}'
image_templates:
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-amd64'
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v6'
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v7'
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm64'
gitea_urls:
api: https://git.cryptic.systems/api/v1
download: https://git.cryptic.systems
version: 2

View File

@ -45,11 +45,11 @@ MD012:
# MD013/line-length - Line length
MD013:
# Number of characters
line_length: 80
line_length: 120
# Number of characters for headings
heading_line_length: 80
heading_line_length: 120
# Number of characters for code blocks
code_block_line_length: 80
code_block_line_length: 120
# Include code blocks
code_blocks: false
# Include tables

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"rewrap.wrappingColumn": 120,
}

View File

@ -1,20 +1,5 @@
FROM docker.io/library/golang:1.20.6-alpine3.18 AS build
FROM scratch AS build
RUN apk add git make
WORKDIR /workspace
ADD ./ /workspace
RUN make install \
DESTDIR=/cache \
PREFIX=/usr \
VERSION=${VERSION}
FROM docker.io/library/alpine:3.18.2
COPY --from=build /cache /
WORKDIR /workspace
VOLUME [ "/workspace" ]
COPY dcmerge-* /usr/bin/dcmerge
ENTRYPOINT [ "/usr/bin/dcmerge" ]

View File

@ -3,22 +3,18 @@
[![Build Status](https://drone.cryptic.systems/api/badges/volker.raschek/dcmerge/status.svg)](https://drone.cryptic.systems/volker.raschek/dcmerge)
[![Docker Pulls](https://img.shields.io/docker/pulls/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.
The dynamic pattern of a docker-compose file, that for example `environments`
can be specified as a string slice or a list of objects is currently not
supported. `dcmerge` expect a strict pattern layout. The `environments`, `ports`
and `volumes` must be declared as a slice of strings.
The dynamic pattern of a docker-compose file, that for example `environments` can be specified as a string slice or a
list of objects is currently not supported. `dcmerge` expect a strict pattern layout. The `environments`, `ports` and
`volumes` must be declared as a slice of strings.
Dockercompose file can be read-in from different sources. Currently are the
following sources supported:
Dockercompose file can be read-in from different sources. Currently are the following sources supported:
- File
- HTTP/HTTPS
Furthermore, `dcmerge` support different ways to merge multiple docker-compose
files.
Furthermore, `dcmerge` support different ways to merge multiple docker-compose files.
- The default merge, add missing secrets, services, networks and volumes.
- The existing-win merge, add and protect existing attributes.
@ -26,9 +22,8 @@ files.
## default
Merge only missing secrets, services, networks and volumes without respecting
their attributes. For example, when the service `app` is already declared, it is
not possible to add the service `app` twice. The second service will be
Merge only missing secrets, services, networks and volumes **without respecting their attributes**. For example, when
the service `app` is already declared, it is not possible to add the service `app` twice. The second service will be
completely skipped.
```yaml
@ -68,10 +63,9 @@ services:
## existing-win
The existing-win merge protects existing attributes. For example there are two
different docker-compose files, but booth has the same environment variable
`CLIENT_SECRET` defined with different values. The first declaration of the
attribute wins and is for overwriting protected.
The existing-win merge protects existing attributes. For example there are two different docker-compose files, but booth
has the same environment variable `CLIENT_SECRET` defined with different values. The first declaration of the attribute
wins and is for overwriting protected.
```yaml
---
@ -99,9 +93,8 @@ services:
## last-win
The last-win merge overwrite recursive existing attributes. For example there
are two different docker-compose files, but booth has the same environment
variable `CLIENT_SECRET` defined with different values. The last passed
The last-win merge overwrite recursive existing attributes. For example there are two different docker-compose files,
but booth has the same environment variable `CLIENT_SECRET` defined with different values. The last passed
docker-compose file which contains this environment wins.
```yaml

View File

@ -8,7 +8,7 @@ import (
"git.cryptic.systems/volker.raschek/dcmerge/pkg/domain/dockerCompose"
"git.cryptic.systems/volker.raschek/dcmerge/pkg/fetcher"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"
)
func Execute(version string) error {
@ -18,7 +18,7 @@ func Execute(version string) error {
Long: "To load completions",
DisableFlagsInUseLine: true,
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
Args: cobra.ExactValidArgs(1),
Args: cobra.MatchAll(cobra.ExactArgs(1)),
Run: func(cmd *cobra.Command, args []string) {
switch args[0] {
case "bash":
@ -42,6 +42,7 @@ dcmerge docker-compose.yml https://git.example.local/user/repo/docker-compose.ym
RunE: run,
Version: version,
}
rootCmd.Flags().BoolP("existing-win", "f", false, "Protect existing attributes")
rootCmd.Flags().BoolP("last-win", "l", false, "Overwrite existing attributes")
rootCmd.Flags().StringP("output-file", "o", "", "Write instead on stdout into a file")
rootCmd.AddCommand(completionCmd)
@ -50,6 +51,11 @@ dcmerge docker-compose.yml https://git.example.local/user/repo/docker-compose.ym
}
func run(cmd *cobra.Command, args []string) error {
mergeExisting, err := cmd.Flags().GetBool("existing-win")
if err != nil {
return fmt.Errorf("Failed to parse flag last-win: %s", err)
}
mergeLastWin, err := cmd.Flags().GetBool("last-win")
if err != nil {
return fmt.Errorf("Failed to parse flag last-win: %s", err)
@ -69,12 +75,15 @@ func run(cmd *cobra.Command, args []string) error {
for _, config := range dockerComposeConfigs {
switch {
case mergeLastWin:
case mergeExisting && mergeLastWin:
return fmt.Errorf("Neither --first-win or --last-win can be specified - not booth.")
case mergeExisting && !mergeLastWin:
dockerComposeConfig.MergeExistingWin(config)
case !mergeExisting && mergeLastWin:
dockerComposeConfig.MergeLastWin(config)
default:
dockerComposeConfig.Merge(config)
}
}
switch {
@ -91,10 +100,12 @@ func run(cmd *cobra.Command, args []string) error {
defer f.Close()
yamlEncoder := yaml.NewEncoder(f)
yamlEncoder.SetIndent(2)
return yamlEncoder.Encode(dockerComposeConfig)
default:
yamlEncoder := yaml.NewEncoder(os.Stdout)
yamlEncoder.SetIndent(2)
return yamlEncoder.Encode(dockerComposeConfig)
}

9
go.mod
View File

@ -3,15 +3,14 @@ module git.cryptic.systems/volker.raschek/dcmerge
go 1.20
require (
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
gopkg.in/yaml.v2 v2.4.0
github.com/spf13/cobra v1.9.1
github.com/stretchr/testify v1.10.0
gopkg.in/yaml.v3 v3.0.1
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
)

16
go.sum
View File

@ -1,4 +1,4 @@
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
@ -6,15 +6,13 @@ github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLf
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
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/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
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/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -12,12 +12,6 @@ manifests:
platform:
architecture: amd64
os: linux
-
image: git.cryptic.systems/volker.raschek/dcmerge:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}-arm-v7
platform:
architecture: arm
os: linux
variant: v7
-
image: git.cryptic.systems/volker.raschek/dcmerge:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}-arm64-v8
platform:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,418 @@
package dockerCompose
import (
"testing"
"github.com/stretchr/testify/require"
)
func Test_splitStringInPortMapping(t *testing.T) {
require := require.New(t)
testCases := []struct {
s string
expectedSrc string
expectedDst string
expectedProtocol string
}{
{
s: "53:53",
expectedSrc: "53",
expectedDst: "53",
expectedProtocol: "",
},
{
s: "0.0.0.0:53:53",
expectedSrc: "0.0.0.0:53",
expectedDst: "53",
expectedProtocol: "",
},
{
s: "0.0.0.0:53:10.11.12.13:53",
expectedSrc: "0.0.0.0:53",
expectedDst: "10.11.12.13:53",
expectedProtocol: "",
},
{
s: "0.0.0.0:53:10.11.12.13:53/tcp",
expectedSrc: "0.0.0.0:53",
expectedDst: "10.11.12.13:53",
expectedProtocol: "tcp",
},
}
for i, testCase := range testCases {
actualSrc, actualDst, actualProtocol := splitStringInPortMapping(testCase.s)
require.Equal(testCase.expectedSrc, actualSrc, "TestCase %v", i)
require.Equal(testCase.expectedDst, actualDst, "TestCase %v", i)
require.Equal(testCase.expectedProtocol, actualProtocol, "TestCase %v", i)
}
}
func TestPort_DstIP(t *testing.T) {
require := require.New(t)
testCases := []struct {
s string
expectedBool bool
expectedString string
}{
{
s: "",
expectedBool: false,
expectedString: "",
},
{
s: "53:53",
expectedBool: false,
expectedString: "",
},
{
s: "53:53/tcp",
expectedBool: false,
expectedString: "",
},
{
s: "53:53/udp",
expectedBool: false,
expectedString: "",
},
{
s: "0.0.0.0:53",
expectedBool: false,
expectedString: "",
},
{
s: "53:0.0.0.0:53",
expectedBool: true,
expectedString: "0.0.0.0",
},
{
s: "53:0.0.0.0:53/tcp",
expectedBool: true,
expectedString: "0.0.0.0",
},
{
s: "53:0.0.0.0:53/udp",
expectedBool: true,
expectedString: "0.0.0.0",
},
{
s: "10.11.12.13:53",
expectedBool: false,
expectedString: "",
},
{
s: "53:10.11.12.13:53",
expectedBool: true,
expectedString: "10.11.12.13",
},
{
s: "53:10.11.12.13:53/tcp",
expectedBool: true,
expectedString: "10.11.12.13",
},
{
s: "53:10.11.12.13:53/udp",
expectedBool: true,
expectedString: "10.11.12.13",
},
}
for i, testCase := range testCases {
p := Port(testCase.s)
require.Equal(testCase.expectedBool, p.existsDstIP(), "TestCase %v", i)
require.Equal(testCase.expectedString, p.getDstIP(), "TestCase %v", i)
}
}
func TestPort_DstPort(t *testing.T) {
require := require.New(t)
testCases := []struct {
s string
expectedBool bool
expectedString string
}{
{
s: "",
expectedBool: false,
expectedString: "",
},
{
s: "53:53",
expectedBool: true,
expectedString: "53",
},
{
s: "53:53/tcp",
expectedBool: true,
expectedString: "53",
},
{
s: "53:53/udp",
expectedBool: true,
expectedString: "53",
},
{
s: "53:0.0.0.0:53",
expectedBool: true,
expectedString: "53",
},
{
s: "53:0.0.0.0:53/tcp",
expectedBool: true,
expectedString: "53",
},
{
s: "53:0.0.0.0:53/udp",
expectedBool: true,
expectedString: "53",
},
{
s: "53:10.11.12.13:53",
expectedBool: true,
expectedString: "53",
},
{
s: "53:10.11.12.13:53/tcp",
expectedBool: true,
expectedString: "53",
},
{
s: "53:10.11.12.13:53/udp",
expectedBool: true,
expectedString: "53",
},
}
for i, testCase := range testCases {
p := Port(testCase.s)
require.Equal(testCase.expectedBool, p.existsDstPort(), "TestCase %v", i)
require.Equal(testCase.expectedString, p.getDstPort(), "TestCase %v", i)
}
}
func TestPort_Protocol(t *testing.T) {
require := require.New(t)
testCases := []struct {
s string
expectedBool bool
expectedString string
}{
{
s: "0",
expectedBool: false,
expectedString: "",
},
{
s: "53/tcp",
expectedBool: false,
expectedString: "",
},
{
s: "53/udp",
expectedBool: false,
expectedString: "",
},
{
s: "53:53",
expectedBool: false,
expectedString: "",
},
{
s: "53:53/tcp",
expectedBool: true,
expectedString: "tcp",
},
{
s: "53:53/udp",
expectedBool: true,
expectedString: "udp",
},
{
s: "0.0.0.0:53:53/tcp",
expectedBool: true,
expectedString: "tcp",
},
{
s: "0.0.0.0:53:53/udp",
expectedBool: true,
expectedString: "udp",
},
{
s: "0.0.0.0:53:53/tcp",
expectedBool: true,
expectedString: "tcp",
},
{
s: "0.0.0.0:53:11.12.13.14:53/tcp",
expectedBool: true,
expectedString: "tcp",
},
{
s: "0.0.0.0:53:11.12.13.14:53/udp",
expectedBool: true,
expectedString: "udp",
},
}
for i, testCase := range testCases {
p := Port(testCase.s)
require.Equal(testCase.expectedBool, p.existsProtocol(), "TestCase %v", i)
require.Equal(testCase.expectedString, p.getProtocol(), "TestCase %v", i)
}
}
func TestPort_SrcIP(t *testing.T) {
require := require.New(t)
testCases := []struct {
s string
expectedBool bool
expectedString string
}{
{
s: "",
expectedBool: false,
expectedString: "",
},
{
s: "53:53",
expectedBool: false,
expectedString: "",
},
{
s: "53:53/tcp",
expectedBool: false,
expectedString: "",
},
{
s: "53:53/udp",
expectedBool: false,
expectedString: "",
},
{
s: "0.0.0.0:53",
expectedBool: false,
expectedString: "",
},
{
s: "0.0.0.0:53:53",
expectedBool: true,
expectedString: "0.0.0.0",
},
{
s: "0.0.0.0:53:53/tcp",
expectedBool: true,
expectedString: "0.0.0.0",
},
{
s: "0.0.0.0:53:53/udp",
expectedBool: true,
expectedString: "0.0.0.0",
},
{
s: "10.11.12.13:53",
expectedBool: false,
expectedString: "",
},
{
s: "10.11.12.13:53:53",
expectedBool: true,
expectedString: "10.11.12.13",
},
{
s: "10.11.12.13:53:53/tcp",
expectedBool: true,
expectedString: "10.11.12.13",
},
{
s: "10.11.12.13:53:53/udp",
expectedBool: true,
expectedString: "10.11.12.13",
},
}
for i, testCase := range testCases {
p := Port(testCase.s)
require.Equal(testCase.expectedBool, p.existsSrcIP(), "TestCase %v", i)
require.Equal(testCase.expectedString, p.getSrcIP(), "TestCase %v", i)
}
}
func TestPort_SrcPort(t *testing.T) {
require := require.New(t)
testCases := []struct {
s string
expectedBool bool
expectedString string
}{
{
s: "",
expectedBool: false,
expectedString: "",
},
{
s: "53:53",
expectedBool: true,
expectedString: "53",
},
{
s: "53:53/tcp",
expectedBool: true,
expectedString: "53",
},
{
s: "53:53/udp",
expectedBool: true,
expectedString: "53",
},
{
s: "0.0.0.0:53:53",
expectedBool: true,
expectedString: "53",
},
{
s: "0.0.0.0:53:53/tcp",
expectedBool: true,
expectedString: "53",
},
{
s: "0.0.0.0:53:53/udp",
expectedBool: true,
expectedString: "53",
},
{
s: "10.11.12.13:53:53",
expectedBool: true,
expectedString: "53",
},
{
s: "10.11.12.13:53:53/tcp",
expectedBool: true,
expectedString: "53",
},
{
s: "10.11.12.13:53:53/udp",
expectedBool: true,
expectedString: "53",
},
}
for i, testCase := range testCases {
p := Port(testCase.s)
require.Equal(testCase.expectedBool, p.existsSrcPort(), "TestCase %v", i)
require.Equal(testCase.expectedString, p.getSrcPort(), "TestCase %v", i)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
services:
frontend:
depends_on:
backend:
condition: service_started
image: library/frontend:latest

View File

@ -0,0 +1,3 @@
services:
backend:
image: library/backend:latest

View File

@ -0,0 +1,7 @@
services:
backend:
image: library/backend:latest
frontend:
depends_on:
- backend
image: library/frontend:latest

View File

@ -0,0 +1,5 @@
services:
frontend:
depends_on:
- backend
image: library/frontend:latest

View File

@ -0,0 +1,3 @@
services:
backend:
image: library/backend:latest

View File

@ -0,0 +1,7 @@
services:
backend:
image: library/backend:latest
frontend:
depends_on:
- backend
image: library/frontend:latest

View File

@ -0,0 +1,6 @@
services:
frontend:
depends_on:
backend:
condition: service_completed_successfully
image: library/frontend:latest

View File

@ -0,0 +1,3 @@
services:
backend:
image: library/backend:latest

View File

@ -0,0 +1,8 @@
services:
backend:
image: library/backend:latest
frontend:
depends_on:
backend:
condition: service_completed_successfully
image: library/frontend:latest

View File

@ -8,7 +8,7 @@ import (
"os"
"git.cryptic.systems/volker.raschek/dcmerge/pkg/domain/dockerCompose"
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"
)
func Fetch(urls ...string) ([]*dockerCompose.Config, error) {
@ -75,7 +75,7 @@ func getDockerComposeViaHTTP(url string) (*dockerCompose.Config, error) {
func readDockerComposeFromFile(name string) (*dockerCompose.Config, error) {
fileStat, err := os.Stat(name)
switch {
case errors.Is(err, os.ErrNotExist):
case err != nil:
return nil, err
case fileStat.IsDir():
return nil, fmt.Errorf("%w: %s", ErrorPathIsDir, name)

View File

@ -1,31 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"assignees": [ "volker.raschek" ],
"automergeStrategy": "merge-commit",
"automergeType": "pr",
"labels": [ "renovate" ],
"packageRules": [
{
"addLabels": [ "renovate/droneci", "renovate/automerge" ],
"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": [ "patch" ]
},
{
"addLabels": [ "renovate/dcmerge", "renovate/automerge" ],
"automerge": false,
"matchPackageNames": [ "dcmerge" ],
"matchManagers": [ "regex" ]
}
],
"rebaseLabel": "renovate/rebase",
"rebaseWhen": "behind-base-branch"
"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"
]
}

View File

@ -0,0 +1,12 @@
version: "3.3"
services:
app:
depends_on:
- oracle
environment:
- HTTP_PROXY=1.2.3.4:8080
image: repository:version
ports:
- 8080:80
volumes:
- /etc/localtime:/etc/localtime

View File

@ -0,0 +1,12 @@
version: "3.3"
services:
app:
depends_on:
- postgres
environment:
- HTTP_PROXY=4.3.2.1:8080
image: repository:version
ports:
- 10080:80
volumes:
- /usr/share/zoneinfo/UTC:/etc/localtime