-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor tests into their own directory * Fix merge conflicts * Clean up and fix import * Add vert instructions for generating version * Add pre-commit hook * Update chart testing section slightly to be more aligned * Update pre-commit hook to automatically bump versions * Update developer docs and appVersion * Only run appVersion update when chart version changes * When running locally, point to upstream instead of origin
- Loading branch information
Showing
5 changed files
with
80 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/python3 | ||
import getopt | ||
import semver | ||
import sys | ||
import yaml | ||
|
||
|
||
def bump_patch(chart_path): | ||
chart_dot_yaml = "%s/Chart.yaml" % chart_path | ||
chart_file = open(chart_dot_yaml) | ||
|
||
chart = yaml.load(chart_file, Loader=yaml.FullLoader) | ||
|
||
version = semver.VersionInfo.parse(chart['version']) | ||
|
||
print(str(version.bump_patch())) | ||
|
||
|
||
def main(argv): | ||
try: | ||
opts, args = getopt.getopt(argv, "i:", ["increment="]) | ||
except getopt.GetoptError: | ||
print("bad options") | ||
sys.exit(2) | ||
for opt, arg in opts: | ||
if opt in ("-i", "-increment"): | ||
bump_patch(arg) | ||
sys.exit() | ||
|
||
|
||
if __name__ == "__main__": | ||
main(sys.argv[1:]) | ||
pelorus_chart = "charts/pelorus" | ||
operator_chart = "charts/operators" | ||
|
||
bump_patch(pelorus_chart) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,34 @@ | ||
#!/bin/bash | ||
|
||
ct lint | ||
bump_version() { | ||
chart=${1} | ||
version=$(python _test/bump_version.py -i ${chart}) | ||
sed -i "s/version:\ .*$/version:\ ${version}/" ${chart}/Chart.yaml | ||
echo "Updated chart ${chart} version to ${version}." | ||
} | ||
|
||
set_app_version() { | ||
version=$(vert -g ^1 $(git describe)) | ||
sed -i "s/appVersion:\ .*$/appVersion:\ ${version}/" charts/pelorus/Chart.yaml | ||
} | ||
|
||
chart_lint=$(ct lint --remote upstream 2>&1) | ||
failed=$? | ||
failed_charts=$(echo "${chart_lint}" | sed -n 's/.*\(path:\ \"\)\(.*\)\".*Chart\ version.*$/\2/p') | ||
|
||
if [ ${failed} -ne 0 ] && [ "${failed_charts}" != "" ]; then | ||
for chart in ${failed_charts}; do | ||
bump_version ${chart} | ||
done | ||
# Recursively call script to ensure tests pass now | ||
./$0 | ||
|
||
# Ensure app version is correct | ||
set_app_version | ||
if [ "$(git diff charts/pelorus/Chart.yaml)" != "" ]; then | ||
echo "Updated charts/pelorus appVersion to $(git describe)." | ||
fi | ||
|
||
echo "Please re-commit." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pytest | ||
coverage | ||
coverage | ||
semver |