From bd63258c768dea88669355f5efe809104b5323dc Mon Sep 17 00:00:00 2001 From: zeaslity Date: Fri, 30 Jun 2023 16:30:31 +0800 Subject: [PATCH] =?UTF-8?q?[=20=E9=A1=B9=E7=9B=AE=20]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?CI=20CD=E6=B5=81=E7=A8=8B=20-=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/wdd/source/shell/agent-bootup.sh | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/source/src/main/java/io/wdd/source/shell/agent-bootup.sh b/source/src/main/java/io/wdd/source/shell/agent-bootup.sh index 83a7d05..38e819b 100644 --- a/source/src/main/java/io/wdd/source/shell/agent-bootup.sh +++ b/source/src/main/java/io/wdd/source/shell/agent-bootup.sh @@ -243,16 +243,17 @@ DownloadAllFile() { echo "start to download all needed lib shell" for libfile in ${DependLibFiles[*]}; do - - colorEcho $BLUE "lib file is $libfile" + colorEcho $BLUE "lib file is => $libfile" wget "$RepoSourcePath/lib/$libfile" -qO $OctopusAgentPath/lib/$libfile - FunctionSuccess + chmod +x $OctopusAgentPath/lib/$libfile + colorEcho $GREEN "load the env file 👇" + . $OctopusAgentPath/lib/$libfile + FunctionSuccess done colorEcho $BLUE "start to download octopus agent !" - # check for latest version - # download the lasted jar + CheckAndDownloadLatestVersion FunctionSuccess @@ -261,29 +262,33 @@ DownloadAllFile() { } CheckAndDownloadLatestVersion() { + FunctionStart + + colorEcho $BLUE "checking for the latest version" + local latestVersion=$(curl $OctopusAgentUrl | grep -v h1 | grep "a href=" | head -1 | awk '{print$2}' | cut -d">" -f2 | cut -d"<" -f1 | cut -d"_" -f4-) - log "checking for the latest version" - local latestVersion=$(curl $OctopusAgentUrl | grep -v h1 | grep "a href=" | awk '{print$2}' | cut -d">" -f2 | cut -d"<" -f1 | cut -d"_" -f4-) - log "" - log "octopus agent latest version is => [ $latestVersion ]" - log "" rm -rf /octopus-agent/octopus-agent* cd /octopus-agent - log "start to download the latest version !" + colorEcho $BLUE "start to download the latest version !" # Agent二进制文件的命名规则为 octopus-agent_linux_amd64_ local latestAgentVersion="octopus-agent_linux_${LinuxRelease}_${latestVersion}" + colorEcho $BLUE "" + colorEcho $BLUE "octopus agent latest version is => [ $latestAgentVersion ]" + colorEcho $BLUE "" wget -q "$OctopusAgentUrl$latestAgentVersion" cp "$latestAgentVersion" octopus-agent chmod +x octopus-agent - log "" - log "" - log "---------------- ls the /octopus-agent ----------------------" + echo "" + echo "" + colorEcho $GREEN "---------------- ls the /octopus-agent ----------------------" ls /octopus-agent/ | grep octopus-agent - log "----------------------------------------------" + + FunctionSuccess + FunctionEnd } @@ -379,7 +384,7 @@ SyslogIdentifier=octopus-agent User=root Type=simple WorkingDirectory=/octopus-agent -ExecStart=/octpus-agent/octopus-agent -agentServerInfoConf=/octpus-agent/octopus-agent.conf -version=shanghai +ExecStart=/octopus-agent/octopus-agent -agentServerInfoConf=/octopus-agent/octopus-agent.conf -version=shanghai ExecStop=/bin/kill -15 \$MAINPID [Install]