milanmk / actions-file-deployer

Composite GitHub Action (Linux runner) for deploying repository content to remote server. Fast and customizable deployment with proxy support. Deploy only changed files or do full sync/mirror of repository content.
The Unlicense
64 stars 15 forks source link

.deploy-running: No such file or directory #28

Closed glenthomas closed 3 months ago

glenthomas commented 8 months ago

I updated from 1.12 to 1.14 and saw this error:

Transfer files
  Protocol: sftp
  Synchronization: full
  Local path: asset
  Remote path: /asset
  ____________________________________________________________________________________________________
  put: /home/runner/work/something/something/.deploy-running: No such file or directory
  Error: Process completed with exit code 1.

I can see this commit in 1.13 updated the paths and I think this has introduced an issue. Reverting to 1.12 solved the problem.

milanmk commented 8 months ago

Version 1.3 has many path related fixes and I would not recommend to downgrade the version.

Please try the following:

  1. Use relative path for local path local-path: ./asset
  2. Double check that the current working directory is correct on remote by login in to SFTP manually and checking the current path. Adjust the remote-path accordingly. You should use relative path to avoid any path related issues.
Djontleman commented 5 months ago

Hi @milanmk, I was looking through the script and have found what I think may be causing the problem.

https://github.com/milanmk/actions-file-deployer/blob/c1baf767551098897cadabc77c520a9be30dc916/action.yml#L355-L358

On line 355 you are adding the file at {local_path_unslash}.deploy_running, but when on 358 when you try and put the file into the remote server you try search for just .deploy_running.

What that says to me is that if local_path_unslash is anything other than ./ then line 358 will fail.

(I'm not really familiar with lftp so I may be wrong)

milanmk commented 5 months ago

@Djontleman put -O option sets the base directory so upload files should only have filename without any path prefix.

What that says to me is that if local_path_unslash is anything other than ./ then line 358 will fail.

That depends on whether you are using absolute or relative path. For relative path of just . will work just fine.

Djontleman commented 4 months ago

put -O option sets the base directory so upload files should only have filename without any path prefix.

I don't think this is correct. Looking at the manual (https://lftp.yar.ru/lftp-man.html), it says:

-O specifies base directory or URL where files should be placed

I don't think this option has any effect on where the command looks for the local file. I think there may be some misunderstanding with where it says:

If -o omitted, the base name of lfile is used as remote name

This is only an assumption, but I think "base name of lfile" is being misinterpreted as the base -O, when I think it actually just means -o defaults to the base path of lfile.

For instance, if lfile was specified as asset/.deploy_running, then -o would default to asset/ (or similar).

I think this is the case, given that in the issue description the put command is looking for [github_runner]/.deploy_running, even though the local path is defined as asset (see my previous comment).

Also note that I have tested using relative path ./asset as the local path and have the exact same error.

Djontleman commented 4 months ago

@milanmk

milanmk commented 3 months ago

I have merged @Djontleman PR which fixes this issue.