deployer icon indicating copy to clipboard operation
deployer copied to clipboard

Keep releases do not work properly

Open antonmedv opened this issue 1 year ago • 5 comments

This workaround solved the problem for us. Add to your deploy.php file:

desc('Fix release_log file');
task('fix:release_log', function() {
    cd('{{deploy_path}}');

    if(test('[ -f .dep/releases_log ]')) {
        $releasesLog = implode("\n", array_map(function($line) {
            if(json_decode($line) === null) {
                $line = str_replace('{ ', '{ "', str_replace(' }', '" }', $line));
                $line = str_replace(' : ', '": "', str_replace(' , ', '", "', $line));
            }

            return $line;
        }, explode("\n", run('cat .dep/releases_log'))));

        run("echo '" . str_replace("'", "'\\''", $releasesLog) . "' > .dep/releases_log");
    }
});

Then, add before('deploy:cleanup', 'fix:release_log'); to fix the log before the cleanup task.

Originally posted by @david-windsock in https://github.com/deployphp/deployer/discussions/3511#discussioncomment-7690796

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 avatar Nov 28 '23 11:11 antonmedv

Thanks @antonmedv, I was going to a new issue but let's keep all here. The problem seems to occur only when a deploy is made from Windows to Linux, resulting in an invalid release_log file format. Each line are not properly escaped (resulting in JSON without double quotes) so releases_log skips all invalid releases.

I think the bug was introduced on 7.1.0 release, because prior to january 2023 the release_log seems to be OK.

Pull requests #3569 and #3603 must solve this problem...

david-windsock avatar Nov 28 '23 11:11 david-windsock

Just to keep this updated: #3569 was discarded in favor of #3603, which was merged two weeks ago. Now waiting for a new release...

david-windsock avatar Feb 26 '24 09:02 david-windsock

There is an estimated date for the next release? Thanks!

david-windsock avatar Apr 16 '24 12:04 david-windsock

Will try to release today.

antonmedv avatar Apr 16 '24 13:04 antonmedv

Thanks @antonmedv

david-windsock avatar Apr 16 '24 13:04 david-windsock