forked from Icycoide/searxng
SearXNG version: fix make docker
continuation of #2117 related to #2111 This commit: * fixes the Docker tag using an additional variable DOCKER_TAG, see searx/version.py * fixes the Docker labels org.label-schema.vcs-ref and org.opencontainers.image.revision * adds searx/version_frozen to .gitignore
This commit is contained in:
parent
eed9b09d98
commit
f759a84af4
4 changed files with 21 additions and 8 deletions
|
@ -62,7 +62,7 @@ def get_git_version():
|
|||
git_commit_date_hash = subprocess_run(r"git show -s --date='format:%Y.%m.%d' --format='%cd+%h'")
|
||||
tag_version = git_version = git_commit_date_hash
|
||||
|
||||
# add "-dirty" suffix if there are uncommited changes except searx/settings.yml
|
||||
# add "+dirty" suffix if there are uncommited changes except searx/settings.yml
|
||||
try:
|
||||
subprocess_run("git diff --quiet -- . ':!searx/settings.yml' ':!utils/brand.env'")
|
||||
except subprocess.CalledProcessError as e:
|
||||
|
@ -70,16 +70,23 @@ def get_git_version():
|
|||
git_version += "+dirty"
|
||||
else:
|
||||
logger.warning('"%s" returns an unexpected return code %i', e.returncode, e.cmd)
|
||||
return git_version, tag_version
|
||||
docker_tag = git_version.replace("+", "-")
|
||||
return git_version, tag_version, docker_tag
|
||||
|
||||
|
||||
try:
|
||||
vf = importlib.import_module('searx.version_frozen')
|
||||
VERSION_STRING, VERSION_TAG, GIT_URL, GIT_BRANCH = vf.VERSION_STRING, vf.VERSION_TAG, vf.GIT_URL, vf.GIT_BRANCH
|
||||
VERSION_STRING, VERSION_TAG, DOCKER_TAG, GIT_URL, GIT_BRANCH = (
|
||||
vf.VERSION_STRING,
|
||||
vf.VERSION_TAG,
|
||||
vf.DOCKER_TAG,
|
||||
vf.GIT_URL,
|
||||
vf.GIT_BRANCH,
|
||||
)
|
||||
except ImportError:
|
||||
try:
|
||||
try:
|
||||
VERSION_STRING, VERSION_TAG = get_git_version()
|
||||
VERSION_STRING, VERSION_TAG, DOCKER_TAG = get_git_version()
|
||||
except subprocess.CalledProcessError as ex:
|
||||
logger.error("Error while getting the version: %s", ex.stderr)
|
||||
try:
|
||||
|
@ -102,6 +109,7 @@ if __name__ == "__main__":
|
|||
|
||||
VERSION_STRING = "{VERSION_STRING}"
|
||||
VERSION_TAG = "{VERSION_TAG}"
|
||||
DOCKER_TAG = "{DOCKER_TAG}"
|
||||
GIT_URL = "{GIT_URL}"
|
||||
GIT_BRANCH = "{GIT_BRANCH}"
|
||||
"""
|
||||
|
@ -114,6 +122,7 @@ GIT_BRANCH = "{GIT_BRANCH}"
|
|||
shell_code = f"""
|
||||
VERSION_STRING="{VERSION_STRING}"
|
||||
VERSION_TAG="{VERSION_TAG}"
|
||||
DOCKER_TAG="{DOCKER_TAG}"
|
||||
GIT_URL="{GIT_URL}"
|
||||
GIT_BRANCH="{GIT_BRANCH}"
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue