Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Version bumping script enhancements
Browse files Browse the repository at this point in the history
Add the ability to switch the namespace and override versions to bump
with using environment variables.
  • Loading branch information
Conky5 committed Mar 18, 2020
1 parent ae168e4 commit c9ad224
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions helpers/bumper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#!/usr/bin/env python2

#
# Usage:
# ./bumper.py
#
# Configurable environment variables:
# - BUMPER_VERSION_6 overrides the 6.x.x version.
# - BUMPER_VERSION_7 overrides the 7.x.x version.
# - BUMPER_USE_STAGING_IMAGES set to "true" causes the
# docker.elastic.co/staging/ docker registry namespace to be used.
#

import re
import os
import glob
Expand All @@ -7,13 +19,13 @@

os.chdir(os.path.join(os.path.dirname(__file__), ".."))

chart_version = "7.6.1"

versions = {
6: "6.8.7",
7: "7.6.1",
6: os.environ.get("BUMPER_VERSION_6", "6.8.7"),
7: os.environ.get("BUMPER_VERSION_7", "7.6.1"),
}

chart_version = versions[7]

file_patterns = [
"*/examples/*/test/goss*.y*ml",
"*/examples/*/*.y*ml",
Expand All @@ -40,3 +52,22 @@
print(r.sub(chart_version, line.rstrip()))
else:
print(r.sub(version, line.rstrip()))

if os.environ.get("BUMPER_USE_STAGING_IMAGES") == "true":
image_file_patterns = file_patterns + [
"*/tests/*.py",
"**/templates/*.tpl",
"**/Makefile",
]

for pattern in image_file_patterns:
for f in glob.glob(pattern):
print(f)
for line in fileinput.input([f], inplace=True):
print(
re.sub(
r"docker.elastic.co/.+/",
"docker.elastic.co/staging/",
line.rstrip(),
)
)

0 comments on commit c9ad224

Please sign in to comment.