jenkinsci / publish-over-ssh-plugin

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

[JENKINS-61587] don't create remote directory when there are no files to publish #84

Open jira-importer opened 4 years ago

jira-importer commented 4 years ago

We have a general build pipeline script that is reused by all our projects. It publishes some files to a documentation server with the sshPublisher step. But some projects don't have any documentation, and I would like to have no empty directory created for that project in that case.

We see the following:

SSH: Connecting from host [dc45dd1bbce5]
SSH: Connecting with configuration [doc.cbss.inet] ...
SSH: Disconnecting configuration [doc.cbss.inet] ...
SSH: Transferred 0 file(s)

So no files are transferred, but the configured remoteDirectory is still created, as specified in the documentation:

remoteDirectory: Optional destination folder.
This folder will be below the one in the global configuration, if present.
The folder will be created if does not exist.

I tried to specify makeEmptyDirs = false but that has no effect. I don't think that setting applies to the remoteDirectory.


Originally reported by jpraet, imported from: don't create remote directory when there are no files to publish
  • status: Open
  • priority: Minor
  • resolution: Unresolved
  • imported: 2022/01/10
jira-importer commented 4 years ago

jpraet:

As a workaround I added

execCommand: "rmdir -p --ignore-fail-on-non-empty ${remoteDirectory}"