mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-06-25 00:30:17 +02:00
Tweaks for issue #45
- Issue #45 - Adds "ssh_needs_tty" which appends "-t" to the ssh. - Issue #45 - Rsync is incremental if there are previous releases.
This commit is contained in:
parent
8b43a136dd
commit
7c883d2436
|
@ -190,7 +190,7 @@ abstract class AbstractTask
|
||||||
}
|
}
|
||||||
|
|
||||||
// if general.yml includes "ssy_needs_tty: true", then add "-t" to the ssh command
|
// if general.yml includes "ssy_needs_tty: true", then add "-t" to the ssh command
|
||||||
$needs_tty = ($this->getConfig()->general('ssh_needs_tty',false) ? "-t" : "");
|
$needs_tty = ($this->getConfig()->general('ssh_needs_tty',false) ? '-t' : '');
|
||||||
|
|
||||||
$localCommand = 'ssh ' . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
|
$localCommand = 'ssh ' . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
|
||||||
. '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
|
. '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
|
||||||
|
|
|
@ -75,17 +75,18 @@ class RsyncTask extends AbstractTask implements IsReleaseAware
|
||||||
if ($this->getConfig()->release('enabled', false) == true) {
|
if ($this->getConfig()->release('enabled', false) == true) {
|
||||||
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
|
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
|
||||||
|
|
||||||
|
$currentRelease = false;
|
||||||
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
|
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
|
||||||
. '/' . $releasesDirectory
|
. '/' . $releasesDirectory
|
||||||
. '/' . $this->getConfig()->getReleaseId();
|
. '/' . $this->getConfig()->getReleaseId();
|
||||||
$resultFetch = $this->runCommandRemote('ls -ld current | cut -d"/" -f2', $releaseToOverride);
|
$resultFetch = $this->runCommandRemote('ls -ld current | cut -d"/" -f2', $currentRelease);
|
||||||
|
|
||||||
if ( $resultFetch ) {
|
if ($resultFetch && $currentRelease) {
|
||||||
// If deployment configuration is rsync, include a flag to simply sync the deltas between the prior release
|
// If deployment configuration is rsync, include a flag to simply sync the deltas between the prior release
|
||||||
// rsync: { copy: yes }
|
// rsync: { copy: yes }
|
||||||
$rsync_copy = $this->getConfig()->deployment("rsync");
|
$rsync_copy = $this->getConfig()->deployment('rsync');
|
||||||
if ( $rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] ) {
|
if ( $rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] ) {
|
||||||
$this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $releaseToOverride . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
|
$this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $currentRelease . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
|
||||||
} else {
|
} else {
|
||||||
$this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
|
$this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue