mirror of
https://github.com/ConnectedHumber/Air-Quality-Web
synced 2024-11-22 06:23:01 +00:00
Use sftp to upload, and then lftp to do the complex fiddling
This commit is contained in:
parent
86e7974018
commit
11c47d599e
1 changed files with 16 additions and 4 deletions
20
build
20
build
|
@ -320,12 +320,21 @@ task_deploy() {
|
||||||
|
|
||||||
task_end $?;
|
task_end $?;
|
||||||
|
|
||||||
|
task_begin "Acquiring upload lock";
|
||||||
task_begin "Uploading release";
|
|
||||||
# Acquire an exclusive project-wide lock so that we only upload stuff one-at-a-time
|
# Acquire an exclusive project-wide lock so that we only upload stuff one-at-a-time
|
||||||
exec 9<"${WORKSPACE}";
|
exec 9<"${WORKSPACE}";
|
||||||
flock --exclusive 9;
|
flock --exclusive 9;
|
||||||
|
task_end $? "Failed to acquire lock!";
|
||||||
|
|
||||||
|
task_begin "Uploading release";
|
||||||
|
sftp -i "${SSH_KEY_PATH}" -P "${deploy_ssh_port}" -o PasswordAuthentication=no "${deploy_ssh_user}@${deploy_ssh_host}" << SFTPCOMMANDS
|
||||||
|
mkdir ${deploy_root_dir}/www-new
|
||||||
|
put -r ${source_upload_dir}/* ${deploy_root_dir}/www-new
|
||||||
|
bye
|
||||||
|
SFTPCOMMANDS
|
||||||
|
task_end $?;
|
||||||
|
|
||||||
|
task_begin "Making release live";
|
||||||
# Actions:
|
# Actions:
|
||||||
# 1. Connect to remote server
|
# 1. Connect to remote server
|
||||||
# 2. Upload new files
|
# 2. Upload new files
|
||||||
|
@ -348,13 +357,16 @@ task_deploy() {
|
||||||
echo "bye";
|
echo "bye";
|
||||||
) >"${lftp_commands_filename}";
|
) >"${lftp_commands_filename}";
|
||||||
|
|
||||||
|
|
||||||
execute lftp --version;
|
execute lftp --version;
|
||||||
execute cat "${lftp_commands_filename}";
|
execute cat "${lftp_commands_filename}";
|
||||||
execute lftp -f "${lftp_commands_filename}";
|
execute lftp -f "${lftp_commands_filename}";
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
exec 9>&- # Close file descriptor 9 and release the lock
|
task_end "${exit_code}" "Failed to make release live";
|
||||||
|
|
||||||
task_end "${exit_code}" "Failed to upload release";
|
task_begin "Releasing lock";
|
||||||
|
exec 9>&- # Close file descriptor 9 and release the lock
|
||||||
|
task_end $?;
|
||||||
|
|
||||||
|
|
||||||
task_begin "Cleaning up";
|
task_begin "Cleaning up";
|
||||||
|
|
Loading…
Reference in a new issue