diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/build_manager.sh b/build_manager.sh index ac70b26..0c0feb5 100755 --- a/build_manager.sh +++ b/build_manager.sh @@ -210,6 +210,36 @@ function generate_portainer_jwt() { curl -d ${payload} -H 'Content-Type: application/json' "http://${address}:9000/api/auth" } +function get_portainer_ce_api_reference() { + printf "${HIGHLIGHT_COLOR}Get the reference of Portainer CE API${NO_COLOR}\n" + + cd ${WORKDIR}/portainer + + if ! check_branch; then + exit; + fi + + read -p "Commit(HEAD):" commit + if [ -z "$commit" ]; then + commit=$(git rev-parse HEAD) + fi + printf "${HIGHLIGHT_COLOR}Installing github.com/portainer/portainer/api@${commit}${NO_COLOR}\n" + + output=$(go install github.com/portainer/portainer/api@${commit}) | while IFS= read -r line; do + echo "$line" + done + + # result=" + # go: downloading github.com/portainer/portainer/api v0.0.0-20220622202437-f0ca3e63db9d + # go: downloading github.com/portainer/portainer v0.6.1-0.20220622202437-f0ca3e63db9d + # package github.com/portainer/portainer/api is not a main package + # " + + # while IFS= read -r line; do + # echo "$line" + # done <<< $(echo ${result}) +} + function menu() { PS3='Please select the option: ' OPTIONS=( @@ -218,6 +248,7 @@ function menu() { 'Build Portainer EE/CE Backend' 'Generate Portainer EE/CE JWT' 'Run Before Commit [Portainer EE/CE]' + 'Get Portainer CE API Reference' 'Run Before Commit [k8s]' 'Build Portainer Agent' 'Cleanup Temporary Volume' @@ -242,6 +273,9 @@ function menu() { 'Run Before Commit [Portainer EE/CE]') run_before_commit ;; + 'Get Portainer CE API Reference') + get_portainer_ce_api_reference + ;; 'Run Before Commit [k8s]') run_before_commit_k8s ;;