diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index d990417..3c9d3b3 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -133,10 +133,11 @@ jobs: echo "current date is $(date)" 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 "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 echo "--------------------------------------" diff --git a/source/src/main/java/io/wdd/source/shell/agent-update-complete.sh b/source/src/main/java/io/wdd/source/shell/agent-update-complete.sh deleted file mode 100644 index 8737383..0000000 --- a/source/src/main/java/io/wdd/source/shell/agent-update-complete.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - - -# 完整的更新Octopus Agent -# 删除旧的Agent, \ No newline at end of file diff --git a/source/src/main/java/io/wdd/source/shell/agent-update.sh b/source/src/main/java/io/wdd/source/shell/agent-update.sh index ab0014f..69ceeb3 100644 --- a/source/src/main/java/io/wdd/source/shell/agent-update.sh +++ b/source/src/main/java/io/wdd/source/shell/agent-update.sh @@ -8,8 +8,8 @@ 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 warn "agent-bootup.sh not exist! start to download !" diff --git a/source/src/main/java/io/wdd/source/shell/lib/wdd-lib-os.sh b/source/src/main/java/io/wdd/source/shell/lib/wdd-lib-os.sh index 4e4f1ef..8ccf8c0 100644 --- a/source/src/main/java/io/wdd/source/shell/lib/wdd-lib-os.sh +++ b/source/src/main/java/io/wdd/source/shell/lib/wdd-lib-os.sh @@ -3,6 +3,15 @@ . /octopus-agent/shell/lib/wdd-lib-log.sh 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() { @@ -25,3 +34,47 @@ CheckAndDownloadLatestVersion() { 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 + +} diff --git a/source/src/main/java/io/wdd/source/shell/lib/wdd-lib-sys.sh b/source/src/main/java/io/wdd/source/shell/lib/wdd-lib-sys.sh index 31630c2..dcfd062 100644 --- a/source/src/main/java/io/wdd/source/shell/lib/wdd-lib-sys.sh +++ b/source/src/main/java/io/wdd/source/shell/lib/wdd-lib-sys.sh @@ -149,7 +149,7 @@ wget https://raw.githubusercontent.com/zeaslity/ProjectOctopus/main/source/src/m 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}'