[ 项目 ] 修改CI CD流程 - 3

This commit is contained in:
zeaslity
2023-06-30 16:30:31 +08:00
parent efe7a836ba
commit bd63258c76

View File

@@ -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_<version>
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]