Deployer 7, rsync, cwd #3604
-
I am running deployer 7 within a docker container. The container has the workdir set to /var/www/html/htdocs, but the Git repository root is /var/www/html. I cannot find a way to run rsync relative to the Git repository root - I tried combinations of This is especially painful in the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I didn't get the question. |
Beta Was this translation helpful? Give feedback.
-
Well, I was making a recipe similar to the packaged |
Beta Was this translation helpful? Give feedback.
-
Hmm ok, let me try again :) We have a docker container with this minimal Dockerfile:
Mounted into the
I run
Deployer starts with CWD I defined a task task('push:all', static function () {
$local_base = trim(runLocally("git rev-parse --show-toplevel"));
$files = explode("\n", runLocally("git ls-files --others --modified --exclude-standard", ['cwd' => $local_base]));
if (count($files) == 0 || empty($files[0])) {
throw new Deployer\Exception\GracefulShutdownException('No new or modified files in work directory, nothing to do');
}
info('uploading:');
foreach ($files as $file) {
writeln(" - $file");
}
upload(
$files,
'{{current_path}}',
['progress_bar' => false, 'options' => ['--relative']]
);
// Mark this release as dirty.
run("echo '{{user}}' > {{current_path}}/DIRTY_RELEASE");
info('done');
}); Basically copying the push function that ships with deployer, with two differences: 1) it also catches git-untracked files, and 2) it always examines the git repository root instead of starting from Here's the issue:
There are some workarounds, but they all feel icky, namely:
I would hope/expect that upload would take a |
Beta Was this translation helpful? Give feedback.
I don't know your knowledge cutoff ^^ but the code ChatGPT generated is wrong, because
deploy_path
refers to the target system. Like I said, what needs to be done is a song-and-dance with putenv, like so:While I don't mind using ChatGPT to formulate responses, I think removing the obvious giveaways like "my knowledge cutoff" and maybe sanity checking the answer might be useful... ;)