mirror of
https://github.com/thegeeklab/docker-autotag.git
synced 2024-11-05 08:50:40 +00:00
feat: add option DOCKER_AUTOTAG_SUFFIX_STRICT (#139)
This commit is contained in:
parent
ce991cc745
commit
3813f7c6b1
@ -21,6 +21,8 @@ Simple tool to create a list of docker tags from a given version string.
|
||||
DOCKER_AUTOTAG_OUTPUT_FILE=
|
||||
# adds a given suffix to every determined tag
|
||||
DOCKER_AUTOTAG_SUFFIX=
|
||||
# returns only tags with the applied suffix
|
||||
DOCKER_AUTOTAG_SUFFIX_STRICT=False
|
||||
# version string to use; returns 'latest' if nothing is specified
|
||||
DOCKER_AUTOTAG_VERSION=
|
||||
# comma-seprated list of static tags to add to the result set
|
||||
@ -59,6 +61,9 @@ DOCKER_AUTOTAG_IGNORE_PRERELEASE=True DOCKER_AUTOTAG_VERSION=1.0.0-beta docker-a
|
||||
DOCKER_AUTOTAG_SUFFIX=amd64 DOCKER_AUTOTAG_VERSION=1.0.0 docker-autotag
|
||||
# 1.0.0,1.0,1,1.0.0-amd64,1.0-amd64,1-amd64
|
||||
|
||||
DOCKER_AUTOTAG_SUFFIX=amd64 DOCKER_AUTOTAG_SUFFIX_STRICT=True DOCKER_AUTOTAG_VERSION=1.0.0 docker-autotag
|
||||
# 1.0.0-amd64,1.0-amd64,1-amd64
|
||||
|
||||
DOCKER_AUTOTAG_EXTRA_TAGS=extra1,extra2 DOCKER_AUTOTAG_VERSION=1.0.0 docker-autotag
|
||||
# 1.0.0,1.0,1,extra1,extra2
|
||||
```
|
||||
|
@ -42,6 +42,7 @@ class Autotag:
|
||||
config["file"] = normalize_path(output_raw)
|
||||
|
||||
config["suffix"] = os.environ.get("DOCKER_AUTOTAG_SUFFIX", None)
|
||||
config["suffix_strict"] = to_bool(os.environ.get("DOCKER_AUTOTAG_SUFFIX_STRICT", False))
|
||||
config["version"] = os.environ.get("DOCKER_AUTOTAG_VERSION", None)
|
||||
config["extra"] = os.environ.get("DOCKER_AUTOTAG_EXTRA_TAGS", None)
|
||||
config["force_latest"] = to_bool(os.environ.get("DOCKER_AUTOTAG_FORCE_LATEST", False))
|
||||
@ -58,11 +59,14 @@ class Autotag:
|
||||
return tags + e
|
||||
|
||||
@staticmethod
|
||||
def _tag_suffix(tags, suffix):
|
||||
def _tag_suffix(tags, suffix, suffix_strict):
|
||||
if not suffix:
|
||||
return tags
|
||||
|
||||
res = copy.deepcopy(tags)
|
||||
res = []
|
||||
if not suffix_strict:
|
||||
res = copy.deepcopy(tags)
|
||||
|
||||
for t in tags:
|
||||
if t == "latest":
|
||||
res.append(suffix)
|
||||
@ -116,7 +120,7 @@ class Autotag:
|
||||
config = self.config
|
||||
|
||||
v = self._default_tags(config["version"], config["ignore_pre"], config["force_latest"])
|
||||
v = self._tag_suffix(v, config["suffix"])
|
||||
v = self._tag_suffix(v, config["suffix"], config["suffix_strict"])
|
||||
v = self._tag_extra(v, config["extra"])
|
||||
|
||||
if config["file"]:
|
||||
|
Loading…
Reference in New Issue
Block a user