UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Commit 3d80c360 authored by Zachariah Dzielinski's avatar Zachariah Dzielinski
Browse files

Added basegitrepository.yaml tag check

parent 89ec6a6a
No related branches found
No related tags found
1 merge request!158Linting for changelog and version
......@@ -53,6 +53,7 @@ version:
allow_failure: true
variables:
CHART_FILE: chart/Chart.yaml
BASEGIT_FILE: base/gitrepository.yaml
script:
- git fetch --all
- ./scripts/lint_version.sh
......
#!/usr/bin/env bash
# obtain the default version
default_version=$(git show origin/${CI_DEFAULT_BRANCH}:${CHART_FILE} | grep -oP 'version: \K(.*)')
# obtain the default chart version
chart_default_version=$(git show origin/${CI_DEFAULT_BRANCH}:${CHART_FILE} | ggrep -oP 'version: \K(.*)')
# check for command error
if [ $? -ne 0 ]; then
......@@ -9,8 +9,8 @@ if [ $? -ne 0 ]; then
exit 1
fi
# obtain the local version
local_version=$(cat ${CHART_FILE} | grep -oP 'version: \K(.*)')
# obtain the local chart version
chart_local_version=$(cat ${CHART_FILE} | ggrep -oP 'version: \K(.*)')
# check for command error
if [ $? -ne 0 ]; then
......@@ -18,15 +18,47 @@ if [ $? -ne 0 ]; then
exit 1
fi
# obtain the default base git repository tag
basegit_default_tag=$(git show origin/${CI_DEFAULT_BRANCH}:${BASEGIT_FILE} | ggrep -oP 'tag: \K(.*)')
# check for command error
if [ $? -ne 0 ]; then
echo "Error: An unknown error has occurred while attempting to retrieve the default tag from ${BASEGIT_FILE}"
exit 1
fi
# obtain the local base git repository tag
basegit_local_tag=$(cat ${BASEGIT_FILE} | ggrep -oP 'tag: \K(.*)')
# check for command error
if [ $? -ne 0 ]; then
echo "Error: An unknown error has occurred while attempting to retrieve the local tag from ${BASEGIT_FILE}"
exit 1
fi
# debug print
echo "Default version: $default_version"
echo "Local version: $local_version"
echo "Default chart version: $chart_default_version"
echo "Local chart version: $chart_local_version"
# assume success
exit_code=0
# error if the versions are not different
if [[ "$default_version" == "$local_version" ]]; then
if [[ "$chart_default_version" == "$chart_local_version" ]]; then
echo "The version has not been updated in ${CHART_FILE}, please update this file"
exit 1
exit_code=1
fi
echo "--"
echo "Default base git repository version: $basegit_default_tag"
echo "Local base git repository version: $basegit_local_tag"
# error if the versions are not different
if [[ "$chart_default_version" == "$chart_local_version" ]]; then
echo "The tag has not been updated in ${CHART_FILE}, please update this file"
exit_code=1
fi
# default to success
exit 0
\ No newline at end of file
# exit with stored code
exit $exit_code
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment