Browse Source

fix(drone): enhance SSH command and cloning logic for deployment

- Updated the SSH command in the Drone configuration to include additional options for improved connection stability and security.
- Modified the cloning logic to use a shallow clone and added error handling for the SSH connection, ensuring a more robust deployment process.

These changes optimize the deployment workflow by enhancing SSH configurations and improving the handling of project cloning.
main
npmrun 2 weeks ago
parent
commit
37c9ac6b5d
  1. 3
      .drone.yml

3
.drone.yml

@ -36,6 +36,7 @@ steps:
- chmod 600 "$HOME/.ssh/id_rsa"
- 'ssh-keyscan -p 8892 -H git.xieyaxin.top >> "$HOME/.ssh/known_hosts"'
- chmod 644 "$HOME/.ssh/known_hosts"
- 'if [ ! -d "$HOME/projects/nuxt4-demo/nuxt4-demo" ]; then mkdir -p "$HOME/projects/nuxt4-demo" && GIT_SSH_COMMAND="ssh -i $HOME/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=accept-new" git clone -b main "ssh://root@git.xieyaxin.top:8892/topuser/nuxt4-demo.git" "$HOME/projects/nuxt4-demo/nuxt4-demo"; else cd "$HOME/projects/nuxt4-demo/nuxt4-demo" && GIT_SSH_COMMAND="ssh -i $HOME/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=accept-new" git pull origin main; fi'
- 'GIT_SSH_COMMAND="ssh -i $HOME/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=accept-new -o BatchMode=yes -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=3" ssh -T -p 8892 root@git.xieyaxin.top || true'
- 'if [ ! -d "$HOME/projects/nuxt4-demo/nuxt4-demo" ]; then mkdir -p "$HOME/projects/nuxt4-demo" && GIT_SSH_COMMAND="ssh -i $HOME/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=accept-new -o BatchMode=yes -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=3" git clone --depth 1 -b main "ssh://root@git.xieyaxin.top:8892/topuser/nuxt4-demo.git" "$HOME/projects/nuxt4-demo/nuxt4-demo"; else cd "$HOME/projects/nuxt4-demo/nuxt4-demo" && GIT_SSH_COMMAND="ssh -i $HOME/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=accept-new -o BatchMode=yes -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=3" git pull origin main; fi'
- pm2 stop nuxt4-demo
- pm2 start nuxt4-demo
Loading…
Cancel
Save