andres-montanez / Magallanes

The PHP Deployment Tool
https://magephp.com
MIT License
694 stars 167 forks source link

Invalid remote directory structure when environment "from" is specified(not default value) #423

Closed EuphoryX1 closed 3 years ago

EuphoryX1 commented 6 years ago

I tried to deploy directory which is expanded from an archive. Assume the archive is expanded in a temporary directory.

.mage.yml
temporary/
  app/
  src/
  composer.json

In this case from environment should be "from: ./temporary/". I expected that remote directory structure to be:

${host_path}/releases/.../
  app/
  src/
  composer.json

But.. As local directory structure is included in tar archive sent to remote, actual remote directory structure is:

${host_path}/releases/.../temporary/
  app/
  src/
  composer.json

When I used MagallanesV1 and tried the same case, remote directry strucure was what I expected.

I think the code of generating tar archive should be modified to use tar -C option.

https://github.com/andres-montanez/Magallanes/blob/e30de6b719c923d70917a9f9364efdb29b7e9362/src/Task/BuiltIn/Deploy/Tar/PrepareTask.php#L47

NOTE: This modification will break backward compatibility if from envlronment is set. Please give me some advice to extend "from" environment specification not to break compatibility.

DanielSchwiperich commented 6 years ago

Stumbled about it today also. A workaround / hack is just to misuse the from option.

Use

from: -C ./temporary ./

And it should work

mvscheidt commented 6 years ago

PR #424 may be related if I understand the PR correctly.

andres-montanez commented 3 years ago

Hi, this was improved in v4.1.1 Regards!