in utils/bump-version.py [0:0]
def main():
if len(sys.argv) != 2:
print("usage: utils/bump-version.py [stack version]")
exit(1)
stack_version = sys.argv[1]
try:
python_version = re.search(r"^([0-9][0-9\.]*[0-9]+)", stack_version).group(1)
except AttributeError:
print(f"Couldn't match the given stack version {stack_version!r}")
exit(1)
# Pad the version value with .0 until there
# we have the major, minor, and patch.
for _ in range(3):
if len(python_version.split(".")) >= 3:
break
python_version += ".0"
find_and_replace(
path=SOURCE_DIR / "elastic_enterprise_search/_version.py",
pattern=r"__version__ = \"[0-9]+[0-9\.]*[0-9](?:\+dev)?\"",
replace=f'__version__ = "{python_version}"',
)
# These values should always be the 'major.minor-SNAPSHOT'
major_minor_version = ".".join(python_version.split(".")[:2])
find_and_replace(
path=SOURCE_DIR / ".buildkite/pipeline.yml",
pattern=r'STACK_VERSION:\s+\- "[0-9]+[0-9\.]*[0-9](?:\-SNAPSHOT)?"',
replace=f'STACK_VERSION:\n - "{major_minor_version}.0-SNAPSHOT"',
)
find_and_replace(
path=SOURCE_DIR / ".github/workflows/unified-release.yml",
pattern=r'STACK_VERSION:\s+"[0-9]+[0-9\.]*[0-9](?:\-SNAPSHOT)?"',
replace=f'STACK_VERSION: "{major_minor_version}-SNAPSHOT"',
)