jenkinsci / publish-over-ssh-plugin

https://plugins.jenkins.io/publish-over-ssh/
117 stars 150 forks source link

[JENKINS-17052] Change to root directory of host configuration didn't work #205

Open jira-importer opened 11 years ago

jira-importer commented 11 years ago

Host configuration has an absolute directory and the publisher step has a relative path.
The creation of the folder structure works, but the commands are executed in the home directory of the user itself.


Originally reported by cschulz, imported from: Change to root directory of host configuration didn't work
  • status: Open
  • priority: Major
  • resolution: Unresolved
  • imported: 2022/01/10
jira-importer commented 11 years ago

bap:

You are correct.

The remote directories are for knowing where to put the files when using SFTP.

The shell you get when you are executing scripts on a remote server are os/ server specific and therefore there is no standard way to change directory.

I will update the documentation on the wiki and in the help files to make this more obvious.

jira-importer commented 11 years ago

cschulz:

What do you think about changing the directory into the remote directory when opening the exec channel?

jira-importer commented 11 years ago

lkraider:

I agree, it should be enough to automatically perform a "cd" into the concatenated Remote Directory paths after login.

HannesWell commented 4 months ago

I agree, it should be enough to automatically perform a "cd" into the concatenated Remote Directory paths after login.

Having the remoteDirectory as working directory of the execCommand would be very convenient and would avoid the need to duplicate the paths on the remote server in the pipeline while they are already configured in the SSH Server element of the Jenkins System settings.

Is there any chance that this will be implemented? If backwards compatibility is an issue, this could only be enabled on demand by a corresponding flag. It could even be an enum with the values DEFAULT, REMOTE_ROOT, REMOTE_DIRECTORY. DEFAULT would mean the current behavior, REMOTE_ROOT the remote directory from the global configuration and REMOTE_DIRECTORY would be the destination of the transferred files. If no remoteDirectory is specified in the step, then REMOTE_ROOT and REMOTE_DIRECTORY are equivalent.