Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment breaks when done from different platforms (e.g. Windows and Mac) #3478

Closed
klaeser opened this issue Feb 2, 2023 · 9 comments
Closed

Comments

@klaeser
Copy link

klaeser commented Feb 2, 2023

  • Deployer version: 7.1.3

  • Deployment OS: Windows and Mac

    Please, provide a minimal reproducible example of deploy.php
    

it can be any deploy.php which uses the default "deploy:release" task

Steps:

  1. do a deployment from Windows
  2. do a deployment of the same project from Mac to the same destination
    => Error: "undefined array key 2" in release.php on line 49

Explanation:
For each deployment, a line is added to the file .dep/release_log
This is done in vendor/deployer/deployer/recipe/deploy/release.php in line 126 with the following code
$json = escapeshellarg(json_encode($metainfo));
Unfortunately, in Windows, escapeshellarg replaces all double quotes in the string by spaces.
https://www.php.net/manual/en/function.escapeshellarg.php
This results for example in the following entry:
{ created_at : 2023-01-12T09:44:54+0000 , release_name : 7 , user : Firstname Lastname , target : HEAD }
When this line is read and parsed by deployer on a different OS (e.g. Mac), it can not be parsed.
It can only be parsed when the double quotes are contained:
{"created_at":"2023-01-12T09:44:54+0000","release_name":"7","user":"Firstname Lastname","target":"HEAD"}

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@antonmedv antonmedv added the bug label Feb 2, 2023
@fritzmg
Copy link
Contributor

fritzmg commented Feb 3, 2023

I can confirm the problem. However, in my case it does not really seem to be related to the platform, as I always deploy from Windows and always from the Git Bash. Nevertheless, I ended up with a release_log like this:

{"created_at":"2022-12-20T11:29:41+0000","release_name":"1","user":"someusername","target":"somebranch"}
{"created_at":"2022-12-20T11:32:02+0000","release_name":"2","user":"someusername","target":"somebranch"}
{"created_at":"2022-12-20T11:44:52+0000","release_name":"3","user":"someusername","target":"somebranch"}
{"created_at":"2022-12-20T11:51:42+0000","release_name":"4","user":"someusername","target":"somebranch"}
{"created_at":"2022-12-20T13:43:35+0000","release_name":"5","user":"someusername","target":"somebranch"}
{ created_at : 2023-01-10T21:37:58+0000 , release_name : 6 , user : someusername , target : somebranch }
{ created_at : 2023-01-10T21:49:58+0000 , release_name : 7 , user : someusername , target : somebranch }
{ created_at : 2023-01-11T23:49:30+0000 , release_name : 8 , user : someusername , target : somebranch }
{ created_at : 2023-01-18T14:52:12+0000 , release_name : 9 , user : someusername , target : somebranch }
{ created_at : 2023-01-19T17:58:19+0000 , release_name : 10 , user : someusername , target : somebranch }
{ created_at : 2023-01-30T11:40:20+0000 , release_name : 11 , user : someusername , target : somebranch }
{"created_at":"2023-02-03T14:20:05+0000","release_name":"12","user":"Firstname Lastname","target":"somebranch"}

which currently breaks deployment.

@antonmedv
Copy link
Member

Looks like problem is with usage of escapeshell.

@Schrank
Copy link
Contributor

Schrank commented Feb 5, 2023

I have no clue how to fix it, so I asked the community:

https://phpc.social/@Schrank/109812249564590328
https://twitter.com/Fabian_ikono/status/1622220417359400960

Hope this helps :-)

@Schrank
Copy link
Contributor

Schrank commented Feb 5, 2023

P.S. I can't reproduce it on mac (12.6.1 (21G217)) in the current version (Deployer 7.1.3)

@antonmedv
Copy link
Member

I know how to fix it. The same way I did in google/zx.

@Schrank
Copy link
Contributor

Schrank commented Feb 5, 2023

@antonmedv
Copy link
Member

Yes)

Copy link
Contributor

github-actions bot commented Sep 9, 2024

This issue has been automatically closed. Please, open a discussion for bug reports and feature requests.

Read more: [https://github.com//discussions/3888]

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2024
@fritzmg
Copy link
Contributor

fritzmg commented Sep 10, 2024

This was fixed in #3603 and released with 7.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants