From f759a84af419186a2bac6652e0f06dc791d63377 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Fri, 20 Jan 2023 10:32:38 +0000 Subject: 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 --- searx/version.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'searx/version.py') diff --git a/searx/version.py b/searx/version.py index 3df6f459e..fa7cdbc74 100644 --- a/searx/version.py +++ b/searx/version.py @@ -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}" """ -- cgit v1.2.3