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'; NO_COLOR='\033[0m';
function choose_repo() { 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 if [ -z "$REPO" ]; then
REPO="EE"; REPO="EE";
@ -26,6 +26,9 @@ function choose_repo() {
elif [[ "${REPO}" == "ce" || "${REPO}" == "CE" ]]; then elif [[ "${REPO}" == "ce" || "${REPO}" == "CE" ]]; then
cd ${WORKDIR}/portainer cd ${WORKDIR}/portainer
elif [[ "${REPO}" == "k8s" || "${REPO}" == "ks" ]]; then
cd ${WORKDIR}/k8s
fi fi
} }
@ -72,11 +75,12 @@ function choose_export_volume() {
printf "${HIGHLIGHT_COLOR}export PORTAINER_DATA=${PORTAINER_DATA}${NO_COLOR}\n" printf "${HIGHLIGHT_COLOR}export PORTAINER_DATA=${PORTAINER_DATA}${NO_COLOR}\n"
} }
function prepare_temporary_volume() { function cleanup_temporary_volume() {
printf "${HIGHLIGHT_COLOR}Prepare temporary data${NO_COLOR}\n" printf "${HIGHLIGHT_COLOR}Clean temporary data${NO_COLOR}\n"
local VOLUME=~/volumes/temp-data local VOLUME=~/volumes/temp-data
if [ -d ${VOLUME} ]; then 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 read -p "Do you want to clean up the existing data N/(Y)?" CLEAN_DATA
if [[ "${CLEAN_DATA}" == "y" || "${CLEAN_DATA}" == "Y" ]]; then if [[ "${CLEAN_DATA}" == "y" || "${CLEAN_DATA}" == "Y" ]]; then
rm -rvf ${VOLUME}/* rm -rvf ${VOLUME}/*
@ -157,6 +161,21 @@ function run_before_commit() {
yarn lint 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() { function menu() {
PS3='Please select the option: ' PS3='Please select the option: '
OPTIONS=( OPTIONS=(
@ -164,7 +183,8 @@ function menu() {
'Build Portainer Frontend' 'Build Portainer Frontend'
'Build Portainer Backend' 'Build Portainer Backend'
'Run Before Commit' 'Run Before Commit'
'Prepare Temporary Volume' 'Cleanup Temporary Volume'
'Run Before COmmit (k8s)'
'Quit' 'Quit'
) )
@ -183,8 +203,11 @@ function menu() {
'Run Before Commit') 'Run Before Commit')
run_before_commit run_before_commit
;; ;;
'Prepare Temporary Volume') 'Cleanup Temporary Volume')
prepare_temporary_volume cleanup_temporary_volume
;;
'Run Before COmmit (k8s)')
run_before_commit_k8s
;; ;;
'Quit') 'Quit')
break break