diff options
author | Alexandre Flament <alex@al-f.net> | 2023-01-20 10:32:38 +0000 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2023-01-20 10:46:00 +0000 |
commit | f759a84af419186a2bac6652e0f06dc791d63377 (patch) | |
tree | 0f0e4bf4f23f2358876dd8bf03e63d5cbfac03a4 /searx/version.py | |
parent | eed9b09d98d42501ff6782041868db4267fca7d5 (diff) | |
download | searxng-f759a84af419186a2bac6652e0f06dc791d63377.tar.gz searxng-f759a84af419186a2bac6652e0f06dc791d63377.zip |
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
Diffstat (limited to 'searx/version.py')
-rw-r--r-- | searx/version.py | 17 |
1 files changed, 13 insertions, 4 deletions
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}" """ |