deployphp / deployer

The PHP deployment tool with support for popular frameworks out of the box
https://deployer.org
MIT License
10.52k stars 1.48k forks source link

The rsync array options should be merged with defaults #2890

Closed alexander-schranz closed 1 week ago

alexander-schranz commented 2 years ago

https://deployer.org/docs/7.x/contrib/rsync

When defining rsync options only with exclude:

set('rsync',[
    'exclude' => [
        '.git',
        'deploy.php',
        'assets',
    ],
]);

The deploy will fail:

[49.12.78.161]  ErrorException  in rsync.php on line 257:
[49.12.78.161]
[49.12.78.161]   Undefined array key "flags"
[49.12.78.161]

Not sure if it would be possible to define defaults somewhere else so I need not configure all rsync options.

PS: I hope its fine that I created seperate issues and not did pack all into one big issue.

Upvote & Fund

Fund with Polar

coreyworrell commented 2 years ago

Can't you do:

set('rsync', function () {
  return array_merge(get('rsync'), [
    'exclude' => [
      '.git',
      'deploy.php',
    ],
  ]);
});
nvision-luxembourg commented 2 years ago

Hello, Same issue when importing in the deploy.php a yml file with custom conf Placing it in the dpeloy.php makes no sens as the list of excluded files can changed from projects to another.

    rsync:
      exclude:
        - '.git*'
        - .bundler
        - deploy.php

We are obliged to put the whole thing

    rsync:
      exclude:
        - '.git*'
        - .bundler
        - deploy.php
           flags: 'rzcE'
      options: ['delete', 'delete-after', 'force']
      timeout: 3600
      include: []
      filter: []
      exclude-file: false
      include-file: false
      filter-file: false
      filter-perdir: false
github-actions[bot] commented 1 week ago

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

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