add option for k8s helm chart lint check

pull/1/head
oscar 2022-03-24 08:42:49 +13:00
parent 3128354700
commit 7793f7e5f9
1 changed files with 29 additions and 6 deletions

View File

@ -15,7 +15,7 @@ HIGHLIGHT_COLOR='\033[0;32m';
NO_COLOR='\033[0m';
function choose_repo() {
read -p "Choose the working project EE/(CE):" REPO
read -p "Choose the working project EE/(CE)/(k8s):" REPO
if [ -z "$REPO" ]; then
REPO="EE";
@ -26,6 +26,9 @@ function choose_repo() {
elif [[ "${REPO}" == "ce" || "${REPO}" == "CE" ]]; then
cd ${WORKDIR}/portainer
elif [[ "${REPO}" == "k8s" || "${REPO}" == "ks" ]]; then
cd ${WORKDIR}/k8s
fi
}
@ -72,11 +75,12 @@ function choose_export_volume() {
printf "${HIGHLIGHT_COLOR}export PORTAINER_DATA=${PORTAINER_DATA}${NO_COLOR}\n"
}
function prepare_temporary_volume() {
printf "${HIGHLIGHT_COLOR}Prepare temporary data${NO_COLOR}\n"
function cleanup_temporary_volume() {
printf "${HIGHLIGHT_COLOR}Clean temporary data${NO_COLOR}\n"
local VOLUME=~/volumes/temp-data
if [ -d ${VOLUME} ]; then
printf "The current volume is ${VOLUME}. "
read -p "Do you want to clean up the existing data N/(Y)?" CLEAN_DATA
if [[ "${CLEAN_DATA}" == "y" || "${CLEAN_DATA}" == "Y" ]]; then
rm -rvf ${VOLUME}/*
@ -157,6 +161,21 @@ function run_before_commit() {
yarn lint
}
function run_before_commit_k8s() {
printf "${HIGHLIGHT_COLOR}Run before commit${NO_COLOR}\n"
choose_repo
if ! check_branch; then
exit;
fi
printf "${HIGHLIGHT_COLOR}chart-testing ct lint${NO_COLOR}\n"
docker run --rm -it -w /repo -v `pwd`:/repo quay.io/helmpack/chart-testing ct lint --all --config=.ci/ct-config.yaml
}
function menu() {
PS3='Please select the option: '
OPTIONS=(
@ -164,7 +183,8 @@ function menu() {
'Build Portainer Frontend'
'Build Portainer Backend'
'Run Before Commit'
'Prepare Temporary Volume'
'Cleanup Temporary Volume'
'Run Before COmmit (k8s)'
'Quit'
)
@ -183,8 +203,11 @@ function menu() {
'Run Before Commit')
run_before_commit
;;
'Prepare Temporary Volume')
prepare_temporary_volume
'Cleanup Temporary Volume')
cleanup_temporary_volume
;;
'Run Before COmmit (k8s)')
run_before_commit_k8s
;;
'Quit')
break