https://github.com/perbu/docker-semver-generator
Generate docker tags for semver
https://github.com/perbu/docker-semver-generator
Last synced: 15 days ago
JSON representation
Generate docker tags for semver
- Host: GitHub
- URL: https://github.com/perbu/docker-semver-generator
- Owner: perbu
- License: apache-2.0
- Created: 2020-12-13T15:11:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-13T15:30:28.000Z (over 5 years ago)
- Last Synced: 2025-10-19T04:46:29.706Z (10 months ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Generate semver tags for docker images
Semver is nice. The somewhat tricky part is allowing a service to be pinned to a specific MAJOR version
and then tagging your released docker images accordingly.
Given we have the following tags in our repo:
* `0.1.0`
* `0.2.0`
* `0.3.0`
And we then build `0.2.1` - what tags should be applied?
This tools tries to generate those tags. It'll spit out:
`0.2` and `0.2.1`. It will not touch the `0` tag as this should still point to `0.3.0`.
So, in your kubernetes defintions you might then deploy $ARTFACT:0.2 and you'll get updates for the 0.2
branch.
Handling of `latest` is so simple that you don't need any tooling. The tricky bits are sticking on a MAJOR
or MINOR version.
The regular expression used is taken from semver.org.
## Usage
Find a way to get a hold of your current tags.
```shell script
$ cat EXISTING_TAGS | python3 semver-tag.py 0.2.1
```
Complete:
```
echo "0.1.0
0.2.0
0.3.0" | python3 semver-tag.py 0.2.1
0.2.1 0.2
```
I'm using this to in the scripts that apply tags.
You'll need to integrate this with your registry somehow.
Note that this tool hasn't been given much testing. However, as I found nothing like it I thought it might make
sense to publish it. File and issue if you have any comments.
### Bugs and weird stuff:
Ironically there is no versioning of this script. I suggest you copy and adapt.