Skip to content

Commit

Permalink
test: troubleshoot automatic release issue. (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijesh-shah-crest authored Oct 18, 2021
1 parent 3eb75a5 commit ae6fda7
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 17 deletions.
123 changes: 121 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ include = [
python = "^3.7"

[tool.poetry.dev-dependencies]
packaging = "^21.0"
requests = "^2.26.0"
configparser = "^5.0.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
2 changes: 1 addition & 1 deletion sc4s_sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ echo $var

if [ "$var" = "True" ];
then

git config --global user.email "addonfactory@splunk.com"
git config --global user.name "Addon Factory template"
BRANCH=test/sc4s-version-update
Expand Down
25 changes: 13 additions & 12 deletions splunk_matrix_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,27 @@ def get_build_number(token,filter_images,latest_image_digest):
return image

def update_splunk_version(token):
if os.path.isfile('config/splunk_matrix..conf'):
if os.path.isfile('config/splunk_matrix.conf'):
config = configparser.ConfigParser()
config.optionxform=str
config.read('config/splunk_matrix..conf')
config.read('config/splunk_matrix.conf')
update_file = False
images_list = get_images_list(token)
filter_images = filter_image_list(images_list)
for stanza in config.sections():
latest_image_version = get_latest_image(stanza,images_list)
stanza_image_version = config.get(stanza,'VERSION')

if check_image_version(latest_image_version,stanza_image_version):
config.set(stanza,'VERSION',latest_image_version)
latest_image_digest = get_image_digest(token,latest_image_version)
build_number = get_build_number(token,filter_images,latest_image_digest)
config.set(stanza,'BUILD',build_number)
update_file = True
if stanza != 'GENERAL':
latest_image_version = get_latest_image(stanza,images_list)
stanza_image_version = config.get(stanza,'VERSION')

if check_image_version(latest_image_version,stanza_image_version):
config.set(stanza,'VERSION',latest_image_version)
latest_image_digest = get_image_digest(token,latest_image_version)
build_number = get_build_number(token,filter_images,latest_image_digest)
config.set(stanza,'BUILD',build_number)
update_file = True

if update_file:
with open('config/splunk_matrix..conf','w') as configfile:
with open('config/splunk_matrix.conf','w') as configfile:
config.write(configfile)
return "True"
return "False"
Expand Down
6 changes: 4 additions & 2 deletions splunk_sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ else
fi

pip install pip --upgrade
python -m pip install -r requirements.txt
pip install poetry
poetry export --without-hashes --dev -o requirements_dev.txt
pip install -r requirements_dev.txt
splunk_version=$(python splunk_matrix_update.py)
echo $splunk_version

if [ "$splunk_version" = "True" ];
then

git config --global user.email "addonfactory@splunk.com"
git config --global user.name "Addon Factory template"
BRANCH=test/splunk-version-update
Expand Down

0 comments on commit ae6fda7

Please sign in to comment.