[ 项目 ] 修改CI CD流程 - 3
This commit is contained in:
@@ -243,16 +243,17 @@ DownloadAllFile() {
|
|||||||
|
|
||||||
echo "start to download all needed lib shell"
|
echo "start to download all needed lib shell"
|
||||||
for libfile in ${DependLibFiles[*]}; do
|
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
|
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
|
done
|
||||||
|
|
||||||
colorEcho $BLUE "start to download octopus agent !"
|
colorEcho $BLUE "start to download octopus agent !"
|
||||||
# check for latest version
|
|
||||||
# download the lasted jar
|
|
||||||
CheckAndDownloadLatestVersion
|
CheckAndDownloadLatestVersion
|
||||||
|
|
||||||
FunctionSuccess
|
FunctionSuccess
|
||||||
@@ -261,29 +262,33 @@ DownloadAllFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CheckAndDownloadLatestVersion() {
|
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*
|
rm -rf /octopus-agent/octopus-agent*
|
||||||
cd /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>
|
# Agent二进制文件的命名规则为 octopus-agent_linux_amd64_<version>
|
||||||
local latestAgentVersion="octopus-agent_linux_${LinuxRelease}_${latestVersion}"
|
local latestAgentVersion="octopus-agent_linux_${LinuxRelease}_${latestVersion}"
|
||||||
|
colorEcho $BLUE ""
|
||||||
|
colorEcho $BLUE "octopus agent latest version is => [ $latestAgentVersion ]"
|
||||||
|
colorEcho $BLUE ""
|
||||||
|
|
||||||
wget -q "$OctopusAgentUrl$latestAgentVersion"
|
wget -q "$OctopusAgentUrl$latestAgentVersion"
|
||||||
cp "$latestAgentVersion" octopus-agent
|
cp "$latestAgentVersion" octopus-agent
|
||||||
chmod +x octopus-agent
|
chmod +x octopus-agent
|
||||||
log ""
|
echo ""
|
||||||
log ""
|
echo ""
|
||||||
log "---------------- ls the /octopus-agent ----------------------"
|
colorEcho $GREEN "---------------- ls the /octopus-agent ----------------------"
|
||||||
ls /octopus-agent/ | grep octopus-agent
|
ls /octopus-agent/ | grep octopus-agent
|
||||||
log "----------------------------------------------"
|
|
||||||
|
FunctionSuccess
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,7 +384,7 @@ SyslogIdentifier=octopus-agent
|
|||||||
User=root
|
User=root
|
||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=/octopus-agent
|
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
|
ExecStop=/bin/kill -15 \$MAINPID
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|||||||
Reference in New Issue
Block a user