[ CI ] 更新CI流程

This commit is contained in:
zeaslity
2023-02-09 16:43:44 +08:00
parent becceab36b
commit ef3ae9b306
5 changed files with 59 additions and 10 deletions

View File

@@ -133,10 +133,11 @@ jobs:
echo "current date is $(date)" echo "current date is $(date)"
echo "start to copy target jar" echo "start to copy target jar"
local formatTime=$(date --rfc-3339=seconds | cut -d"+" -f1 | sed "s/ /-/g" | sed "s/:/-/g")"
echo "write the version info to env" echo "write the version info to env"
echo "AGENT_VERSION=$(date --rfc-3339=seconds | cut -d"+" -f1 | sed "s/ /-/g" | sed "s/:/-/g")" >> $GITHUB_ENV echo "AGENT_VERSION= ${formatTime}>> $GITHUB_ENV
cp ./agent-*.jar ./octopus-agent-${{ env.AGENT_VERSION }}.jar cp ./agent-*.jar ./octopus-agent-${formatTime}.jar
cd /home/runner/work/ProjectOctopus/ProjectOctopus cd /home/runner/work/ProjectOctopus/ProjectOctopus
echo "--------------------------------------" echo "--------------------------------------"

View File

@@ -1,5 +0,0 @@
#!/bin/bash
# 完整的更新Octopus Agent
# 删除旧的Agent

View File

@@ -8,8 +8,8 @@
RepoSourcePath=https://raw.githubusercontent.com/zeaslity/ProjectOctopus/main/source/src/main/java/io/wdd/source/shell RepoSourcePath=https://raw.githubusercontent.com/zeaslity/ProjectOctopus/main/source/src/main/java/io/wdd/source/shell
# 更新下载所有的内容
CheckAndDownloadLatestVersion DownloadAllFile
if [[ ! -f /octopus-agent/shell/agent-restart.sh ]]; then if [[ ! -f /octopus-agent/shell/agent-restart.sh ]]; then
warn "agent-bootup.sh not exist! start to download !" warn "agent-bootup.sh not exist! start to download !"

View File

@@ -3,6 +3,15 @@
. /octopus-agent/shell/lib/wdd-lib-log.sh . /octopus-agent/shell/lib/wdd-lib-log.sh
OctopusAgentUrl=https://happybirthday.107421.xyz/octopus-agent/ OctopusAgentUrl=https://happybirthday.107421.xyz/octopus-agent/
OctopusAgentPath=/octopus-agent/shell
DependLibFiles=(
wdd-lib-file.sh
wdd-lib-log.sh
wdd-lib-os.sh
wdd-lib-env.sh
wdd-lib-sys.sh
)
CheckAndDownloadLatestVersion() { CheckAndDownloadLatestVersion() {
@@ -25,3 +34,47 @@ CheckAndDownloadLatestVersion() {
log "----------------------------------------------" log "----------------------------------------------"
} }
#######################################
# description
# Globals:
# BLUE
# DependLibFiles
# OctopusAgentPath
# RED
# RepoSourcePath
# libfile
# Arguments:
# None
#######################################
DownloadAllFile() {
FunctionStart
warn "[CLEAN_UP] clean the old octopus agent staff !"
rm -rf $OctopusAgentPath/lib
rm -rf $OctopusAgentPath/
mkdir -p $OctopusAgentPath
mkdir -p $OctopusAgentPath/lib
echo "start to download all needed lib shell"
for libfile in ${DependLibFiles[*]}; do
log "lib file is $libfile"
wget "$RepoSourcePath/lib/$libfile" -qO $OctopusAgentPath/lib/$libfile
FunctionSuccess
done
colorEcho $BLUE "start to download octopus agent !"
# check for latest version
# download the lasted jar
cd $OctopusAgentPath
CheckAndDownloadLatestVersion
FunctionSuccess
FunctionEnd
}

View File

@@ -149,7 +149,7 @@ wget https://raw.githubusercontent.com/zeaslity/ProjectOctopus/main/source/src/m
echo "y echo "y
" | gcloud compute instances delete tokyo-amd64-07 --project=compact-lacing-371804 --zone=asia-northeast1-b " | gcloud compute instances delete tokyo-amd64-13 --project=compact-lacing-371804 --zone=asia-northeast1-b
apt-cache madison openjdk-11-jdk | head -n 1 | awk '{print$3}' apt-cache madison openjdk-11-jdk | head -n 1 | awk '{print$3}'