Commit 4a990a2a authored by Siarhei Khaletski (EPAM)'s avatar Siarhei Khaletski (EPAM) 🚩
Browse files

Added pipeline iid as a build id for package version

parent fc1f4d30
Pipeline #64303 passed with stages
in 2 minutes and 24 seconds
variables:
BUILD_TAG: $CI_COMMIT_TAG
BUILD_COMMIT_SHORT_SHA: $CI_COMMIT_SHORT_SHA
BUILD_ID: $CI_PIPELINE_IID
default: default:
image: python:3.6-slim-buster image: python:3.6-slim-buster
......
...@@ -25,7 +25,7 @@ def get_version_from_file(): ...@@ -25,7 +25,7 @@ def get_version_from_file():
return fh.read().strip() return fh.read().strip()
def prepare_version(): def prepare_version():
version = os.getenv("CI_COMMIT_TAG", '') version = os.getenv("BUILD_TAG", '')
if version.startswith('v'): if version.startswith('v'):
# release tag version, e.g. v0.9.0 # release tag version, e.g. v0.9.0
...@@ -33,8 +33,9 @@ def prepare_version(): ...@@ -33,8 +33,9 @@ def prepare_version():
else: else:
# we assume that it is commit version # we assume that it is commit version
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#local-version-identifiers # https://packaging.python.org/guides/distributing-packages-using-setuptools/#local-version-identifiers
commit = os.environ["CI_COMMIT_SHORT_SHA"] commit = os.environ["BUILD_COMMIT_SHORT_SHA"]
version = f"{get_version_from_file()}.dev+{commit}" build_id = os.environ["BUILD_ID"]
version = f"{get_version_from_file()}.dev{build_id}+{commit}"
return version return version
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment