Skip to content

Commit

Permalink
setup: take a post version from environment variable
Browse files Browse the repository at this point in the history
Make it possible to add a post version (per PEP-440) to the current agent
version at build time. This will be useful because we want to continuously
build the agent on CI and avoid version conflicts when publishing to test pypi.
So when returning the agent version add anything that has been passed
in ELASTIC_CI_POST_VERSION environment variable as post version.

Refs #1994
  • Loading branch information
xrmx authored and v1v committed Mar 11, 2024
1 parent af5c2c9 commit f248801
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def get_version():
if line.startswith("__version__"):
version_tuple = ast.literal_eval(line.split(" = ")[1])
version_str = ".".join(map(str, version_tuple))
local_version = os.getenv("ELASTIC_CI_LOCAL_VERSION")
if local_version:
return f"{version_str}-dev{local_version}"
post_version = os.getenv("ELASTIC_CI_POST_VERSION")
if post_version:
return f"{version_str}.post{post_version}"
return version_str
return "unknown"

Expand Down

0 comments on commit f248801

Please sign in to comment.