appleboy / drone-scp

Copy files and artifacts via SSH using a binary, docker or Drone CI.
MIT License
142 stars 30 forks source link

When the configuration parameter rm is true, an error will be generated #140

Open shuyudao opened 1 year ago

shuyudao commented 1 year ago

settings.rm: true #If true : Process exited with status 1 ; If false : ✅ Successfully...

settings:
    host: ***
    port: 22
    username: root
    password: 
      from_secret: root_password
    strip_components: 1
    overwrite: true
    rm: true #If true : Process exited with status 1
    source: ./dist/*
    target: /target

console logs

tar all files into /tmp/297369615/ZOqVuExJPx.tar
scp file to server.
Remove target folder: ***
drone-scp error:  Process exited with status 1
drone-scp rollback: remove all target tmp file
remove file ZOqVuExJPx.tar
2022/10/30 20:19:41 Process exited with status 1
appleboy commented 1 year ago

I will take it.

sfeilmeier commented 11 months ago

As a note to future readers, as I just had the same issue:

The rm: true option deletes the entire target directory and not only its contents (see also #128). Because of this, the user (defined by username) also needs write access to the parent directory of target.

In my use-case I could solve the issue by adding another subdirectory (target: /target/build), so I did not have to adjust permissions of the parent directory.