diff --git a/build_manager.sh b/build_manager.sh index b1906e9..ac70b26 100755 --- a/build_manager.sh +++ b/build_manager.sh @@ -192,12 +192,31 @@ function run_before_commit_k8s() { docker run --rm -it -w /repo -v `pwd`:/repo quay.io/helmpack/chart-testing ct lint --all --config=.ci/ct-config.yaml } +function generate_portainer_jwt() { + printf "${HIGHLIGHT_COLOR}Generate Portainter JWT${NO_COLOR}\n" + + read -p "Username(admin):" username + if [ -z "$username" ]; then + username="admin"; + fi + + read -p "Password(****):" password + read -p "Address(127.0.0.1):" address + if [ -z "$address" ]; then + address="127.0.0.1"; + fi + + payload="{\"username\":\"${username}\",\"password\":\"${password}\"}" + curl -d ${payload} -H 'Content-Type: application/json' "http://${address}:9000/api/auth" +} + function menu() { PS3='Please select the option: ' OPTIONS=( 'Build Portainer EE/CE All' 'Build Portainer EE/CE Frontend' 'Build Portainer EE/CE Backend' + 'Generate Portainer EE/CE JWT' 'Run Before Commit [Portainer EE/CE]' 'Run Before Commit [k8s]' 'Build Portainer Agent' @@ -217,6 +236,9 @@ function menu() { 'Build Portainer EE/CE Backend') build_portainer_backend ;; + 'Generate Portainer EE/CE JWT') + generate_portainer_jwt + ;; 'Run Before Commit [Portainer EE/CE]') run_before_commit ;;