jenkinsci / publish-over-ftp-plugin

https://plugins.jenkins.io/publish-over-ftp/
21 stars 33 forks source link

[JENKINS-16976] [publish-over-ftp-1.8] upload creates unneeded folders #44

Closed jira-importer closed 11 years ago

jira-importer commented 11 years ago

There are actually 2 flavors to the same bug (it should be maybe 2 bugs):
1. in non-flaten mode, if the uploaded file path is - for example - dir1/dir2/dir3/file.zip then it creates those folders in the FTP server: dir2, dir3, dir1/dir2/dir3 (where it puts the file). The creation of dir2 and dir3 is wrong!
2. in flaten and non-flaten modes, if the target folder has - for example - the format dir1/dir2/dir3, the created folders in the FTP server are: dir1, dir2 and dir3 while it should create only a structure of dir1/dir2/dir3 and puts it there


Originally reported by yorammi, imported from: [publish-over-ftp-1.8] upload creates unneeded folders
  • assignee: bap
  • status: Closed
  • priority: Major
  • resolution: Fixed
  • resolved: 2013-03-03T23:35:00+11:00
  • imported: 2022/01/10
jira-importer commented 11 years ago

bap:

Have you read https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+... - specifically the section on Transfer sets and the examples at the bottom of the page?

1. it looks like you should set:
Source files: dir1/dir2/dir3/file.zip
Remote directory: dir1
Remove prefix: dir1/dir2/dir3/

NB: the Remote directory is relative to the directory specified in the server configuration (in manage Jenkins) so if that is not root, but is dir1, then the remote directory in the transfer set should be empty.

2. I really cannot understand what problem you are trying to describe here. Can you provide an example?

jira-importer commented 11 years ago

yorammi:

About item #1 - the flaten checkbox solved it for me there for it is not critical. Still, seems like a but to be that it created all unneeded folders.
About item #2 - heres the configuration I tried and what it created for me:
Source files: multiPlatform/build/sdk/target/tabtale-sdk-osx-3.6.${BUILD_NUMBER}.zip
Remove prefix:
Remote directory: 3.6/3.6.${BUILD_NUMBER}
I've run it in flaten mode for avoid the first problem, and this is the resulted output:
if BUILD_NUMBER=11 (for example), it creates 2 folders: 3.6 and 3.6.11 (where it puts the zip file) while I expected it to create a 3.6/3.6.11 structure (meaning: a 3.6 folder with 3.6.11 folder in it).
For now I've solved it by avoiding the major-version folder (3.6 in this case) and created a 3.6.11 folder only but this is ugly since after have many versions I'll 3.6 folders in the same level as 3.7 and so on.
I can solve it - for now - by having a different 'ftp server' configuration for each major version (each one will have different 'remote directory') but I prefer to wait for a fix from you.

Thanks.

jira-importer commented 11 years ago

bap:

1. This is by design as described in https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+...
If you do not select flatten and you do not "Remove prefix" then the directories will be copied from the root of the workspace (or artifacts dir).

2. Looks like a bug with the FTP server.
Can you click the Advanced button below the Name drop-down and enable "Verbose output in console"?
Attach the output and configuration (the publisher section from the job config) and I'll take a look at it to try to see what is happening.

jira-importer commented 11 years ago

yorammi:

JENKINS-16976-configuration

jira-importer commented 11 years ago

yorammi:

Configuration:
=============
I'll attach a screenshot

Log:
===
FTP: Connecting from host [TabBuild1.tabtale.local]
FTP: Connecting with configuration [box-ftp-server] ...
220 Service ready for new user.
FTP: Logging in, command printing disabled
FTP: Logged in, command printing enabled
CWD Release/SDK
250 Directory changed to /Release/SDK
FTP: Remote root is not absolute, getting absolute directory from PWD
PWD
257 "/Release/SDK" is current directory.
TYPE I
200 Command TYPE okay.
CWD /Release/SDK
250 Directory changed to /Release/SDK
CWD 3.3/3.3.41
550 No such directory.
MKD 3.3/3.3.41
257 "/Release/SDK/3.3.41" created.
CWD 3.3/3.3.41
550 No such directory.
CWD 3.3
550 No such directory.
MKD 3.3
257 "/Release/SDK/3.3" created.
CWD 3.3
250 Directory changed to /Release/SDK/3.3
CWD 3.3.41
550 No such directory.
MKD 3.3.41
257 "/Release/SDK/3.3/3.3.41" created.
CWD 3.3.41
250 Directory changed to /Release/SDK/3.3/3.3.41
PASV
227 Entering Passive Mode (74,112,184,39,92,57)
STOR tabtale-sdk-osx-3.3.41.zip
150 File status okay; about to open data connection.

jira-importer commented 11 years ago

yorammi:

JENKINS-16976-configuration

jira-importer commented 11 years ago

yorammi:

the created structure - as a result of the above run - is:
path #1: /Release/SDK/3.3/3.3.41/tabtale-sdk-osx-3.3.41.zip
path #2: /Release/SDK/3.3.41 (empty folder)
while path #1 is what I need, path #2 is wrong and mess up the FTP-folder with many empty and unneeded folder.

jira-importer commented 11 years ago

bap:

So, as I suspected your FTP server is not doing what it says it is ...

MKD 3.3/3.3.41
257 "/Release/SDK/3.3.41" created.

... but it says it is ok.

I think the only sensible way to deal with this is to add an option to the FTP server configuration in Manage Jenkins to disable any attempts to create multiple directories in one mkdir command.

I'll take a look at the weekend. Should get a release next week.

jira-importer commented 11 years ago

bap:

I misunderstood you explanation of point 1 above.
You are correct - it is a result of the same problem with the FTP server you are talking to.

The fix is a new Advanced option for FTP Servers called "Don't make nested dirs".
Checking it should fix both of your issues.

jira-importer commented 11 years ago

scm_issue_link:

Code changed in jenkins
User: bap2000
Path:
src/main/java/jenkins/plugins/publish_over_ftp/BapFtpClient.java
src/main/java/jenkins/plugins/publish_over_ftp/BapFtpHostConfiguration.java
src/main/resources/jenkins/plugins/publish_over_ftp/BapFtpHostConfiguration/config.jelly
src/main/resources/jenkins/plugins/publish_over_ftp/BapFtpHostConfiguration/config.properties
src/main/resources/jenkins/plugins/publish_over_ftp/BapFtpHostConfiguration/config_no_BV.properties
src/main/resources/jenkins/plugins/publish_over_ftp/BapFtpHostConfiguration/help-disableMakeNestedDirs.html
src/test/java/jenkins/plugins/publish_over_ftp/BapFtpClientTest.java
src/test/java/jenkins/plugins/publish_over_ftp/BapHostConfigurationTest.java
src/test/java/jenkins/plugins/publish_over_ftp/jenkins/CurrentConfigurationTest.java
src/test/java/jenkins/plugins/publish_over_ftp/jenkins/IntegrationTest.java
src/test/java/jenkins/plugins/publish_over_ftp/jenkins/LegacyConfigurationTest.java
http://jenkins-ci.org/commit/publish-over-ftp-plugin/d34aa3f1d6469609c0d2426b5d72e8aedc09427e
Log:
[FIXED JENKINS-16976] Option to disable nested directory creation for broken FTP servers.


You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

jira-importer commented 11 years ago

yorammi:

Tested OK with version 1.9.
Thanks!