@@ -219,19 +219,21 @@ reset-upload-live:
219219 extends : .deploy-prepare
220220 variables :
221221 script :
222+ # use "stage=live" as default if not defined
223+ - RESET_UPLOAD_SELECTOR="${RESET_UPLOAD_SELECTOR:-stage=live}"
222224 # install rclone and jq
223225 - apk add --update --quiet rclone jq && rclone version && jq --version
224226 # get ssh connection params from deploy.php
225- - SFTP_HOST=$(vendor/bin/dep config --format json $[[ inputs.live_host_selector ]] | jq -r '.[].hostname')
226- - SFTP_USER=$(vendor/bin/dep config --format json $[[ inputs.live_host_selector ]] | jq -r '.[].remote_user')
227- - DEPLOY_PATH=$(vendor/bin/dep config --format json $[[ inputs.live_host_selector ]] | jq -r '.[].deploy_path')
227+ - SFTP_HOST=$(vendor/bin/dep config --format json ${RESET_UPLOAD_SELECTOR} | jq -r '.[].hostname')
228+ - SFTP_USER=$(vendor/bin/dep config --format json ${RESET_UPLOAD_SELECTOR} | jq -r '.[].remote_user')
229+ - DEPLOY_PATH=$(vendor/bin/dep config --format json ${RESET_UPLOAD_SELECTOR} | jq -r '.[].deploy_path')
228230 # set up rclone remotes
229231 - !reference [.reset-prepare, script]
230232 # dump database on source
231- - vendor/bin/dep db:rmdump "$[[ inputs.live_host_selector ]] " --options=dumpcode:resetJob --no-interaction -vvv
232- - vendor/bin/dep db:export "$[[ inputs.live_host_selector ]] " --options=dumpcode:resetJob --no-interaction -vvv
233- - vendor/bin/dep db:process "$[[ inputs.live_host_selector ]] " --options=dumpcode:resetJob --no-interaction -vvv
234- - vendor/bin/dep db:compress "$[[ inputs.live_host_selector ]] " --options=dumpcode:resetJob --no-interaction -vvv
233+ - vendor/bin/dep db:rmdump "${RESET_UPLOAD_SELECTOR} " --options=dumpcode:resetJob --no-interaction -vvv
234+ - vendor/bin/dep db:export "${RESET_UPLOAD_SELECTOR} " --options=dumpcode:resetJob --no-interaction -vvv
235+ - vendor/bin/dep db:process "${RESET_UPLOAD_SELECTOR} " --options=dumpcode:resetJob --no-interaction -vvv
236+ - vendor/bin/dep db:compress "${RESET_UPLOAD_SELECTOR} " --options=dumpcode:resetJob --no-interaction -vvv
235237 # sync database from sftp remote to crypt remote
236238 - ' rclone sync -v --inplace --metadata --include "*dumpcode=resetJob*" --delete-excluded "sftp:${DEPLOY_PATH}/.dep/database/dumps/" ${CRYPT_NAME}:.dep/database/dumps'
237239 # prepare exclude args for rclone
@@ -249,11 +251,9 @@ reset-upload-live:
249251 sh -c "$CMD"
250252 done
251253 rules :
252- - if : ' "$[[ inputs.live_deploy_enabled ]]" != "true"'
253- when : never
254254 - if : ' $CI_SERVER_URL != "$[[ inputs.ci_server_url | expand_vars ]]"'
255255 when : never
256- - if : $RESET_JOB == "true" && $CI_PIPELINE_SOURCE == "schedule" && $ RESET_HOST_SELECTOR == null
256+ - if : $RESET_JOB == "true" && $RESET_HOST_SELECTOR == null
257257
258258# Requires a scheduled job with RESET_JOB == true and RESET_HOST_SELECTOR set with target host selector
259259reset-host :
@@ -289,4 +289,4 @@ reset-host:
289289 vendor/bin/dep run "find public/${dir}/ -type d ! -perm 2770 -user ${SFTP_USER} -exec chmod 2770 {} \;" "${RESET_HOST_SELECTOR}" --no-interaction -vvv
290290 done
291291 rules :
292- - if : $RESET_JOB == "true" && $CI_PIPELINE_SOURCE == "schedule" && $ RESET_HOST_SELECTOR != null
292+ - if : $RESET_JOB == "true" && $RESET_HOST_SELECTOR != null
0 commit comments