dbtag

command module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

README

dbtag - Docker images SemVer (Semantic Versioning) tag tool

A small docker tag wrapper tool which makes fancy semver (https://semver.org) tags for container images. It supports

Getting Started

dbtag provides a consistent docker tags versioning approach. This tool transforms a semver-valid version into the list of tags which contains:

  • short versions tags, such as 1.2, 3.0
  • base versions tags, such as 1.3.1, 1.3.1-r1, 1.2.5-rc.0
  • flavoured tags: 2.5-debian, 1.3.4-debian-r2
  • latest : latest

The main intent is to use dbtag during CI builds to generate a convention based set of docker image tags.

Usage

Usage: dbtag SEMVER_VERSION SOURCE_IMAGE[:TAG] TARGET_IMAGE

  -dryrun
    	Enable dryrun mode, i.e. print the details without execution
  -flavour string
    	Specify the release flavour (ex: 1.2.3-debian, 1.2-debian)
  -latest string
    	Specify the latest falvour and short version (ex: debian, debian:1.2, 3.0)
  -short
    	Specify the short output format (a space separted list of tagged images)
  -v	Prints current version

flavour and latest options might be passed as a CLI option or as DBTAG_FLAVOUR and DBTAG_LATEST environment variable correspondingly. The first option (flavour) works pretty obvious it signals dbtag, to create 1.3.4-debian-r2, 1.3-debian like tags. latest makes fine control over which flavour and version is treated as "latest".

latest is represented as colon separated string, for example: debian:1.2, also it might be a single part which is either a flavour or a version. Note: that version itself is a short version (i.e. major.minor).

latest limits the release of the latest and flavour, it also limits 1.2.3, 1.2 tags.

Simple semver (1.2.0
dbtag --short 1.2.0 alpine testimage

tags:

testimage:1.2.0
testimage:1.2
testimage:latest

Note that short options outputs only the list of tagged images.

Semver with a sequential id (1.2.0+r2)

Semver metadata matching /^r\d+/ (i.e. r1, r211 etc) is treated as sequential id and the following tags are created:

testimage:1.2.0
testimage:1.2.0-r2
testimage:1.2
testimage:latest
Limiting latest tag (1.2.0-r2 + latest=1.3)

Since latest != current semver, for the command:

dbtag --short --latest 1.3 1.2.0+r2 alpine testimage

only the following tags a produced:

testimage:1.2.0
testimage:1.2.0-r2
testimage:1.2

In other words latest or flavoured latests tags are create only if the latest short version matches the released one or the latest version is not specified.

Flavoured release tag (1.2.0 + flavour=debian)
dbtag --flavour debian --latest 1.3 1.2.0 alpine testimage

outputs:

Tagged: testimage:1.2.0-debian
Tagged: testimage:1.2-debian
Flavoured latest release tag (1.2.0 + flavour=debian + latest=debian)
dbtag --flavour debian --latest debian 1.2.0 alpine testimage

outputs:

Tagged: testimage:1.2.0
Tagged: testimage:1.2.0-debian
Tagged: testimage:1.2
Tagged: testimage:1.2-debian
Tagged: testimage:latest
v Style tags
dbtag  v1.2.0-prerelease-rc.0  alpine testimage

outputs:

Tagged: testimage:1.2.0-prerelease-rc.0
Tagged: testimage:v1.2.0-prerelease-rc.0
Prerequisites

You must have the docker binary installed.

Installing

Download the latest release for your platform and set the executable bits.

Running the tests

go get && go test

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL