add command to retrieve golang library mod from git commit number

This commit is contained in:
oscar 2022-07-15 17:56:54 +12:00
parent 4f933b4e38
commit 56d10bc7e4
2 changed files with 34 additions and 0 deletions

0
README.md Normal file → Executable file
View File

View File

@ -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
;;