jenkinsci / scm-sync-configuration-plugin

Jenkins scm-sync-configuration plugin
https://plugins.jenkins.io/scm-sync-configuration/
MIT License
115 stars 123 forks source link

Spaces in job name cause exception #42

Closed ip2k closed 8 years ago

ip2k commented 8 years ago

Looks like an exception handling URIs. The job name in this case is ATS Testing

Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 0: "jobs/ATS%20Testing/config.xml"

Mar 09, 2016 6:33:23 PM FINE hudson.plugins.scm_sync_configuration.SCMManipulator
Checking in SCM files ...
Mar 09, 2016 6:33:23 PM FINER org.apache.maven.scm.manager.ScmManager checkIn
THROW
org.apache.maven.scm.ScmException: Exception while executing SCM command.
    at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:63)
    at org.apache.maven.scm.provider.git.AbstractGitScmProvider.executeCommand(AbstractGitScmProvider.java:291)
    at org.apache.maven.scm.provider.git.AbstractGitScmProvider.checkin(AbstractGitScmProvider.java:217)
    at org.apache.maven.scm.provider.AbstractScmProvider.checkIn(AbstractScmProvider.java:415)
    at org.apache.maven.scm.provider.AbstractScmProvider.checkIn(AbstractScmProvider.java:397)
    at org.apache.maven.scm.manager.AbstractScmManager.checkIn(AbstractScmManager.java:423)
    at hudson.plugins.scm_sync_configuration.SCMManipulator.checkinFiles(SCMManipulator.java:241)
    at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness.processCommitsQueue(ScmSyncConfigurationBusiness.java:223)
    at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness.access$000(ScmSyncConfigurationBusiness.java:32)
    at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness$1.call(ScmSyncConfigurationBusiness.java:148)
    at hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness$1.call(ScmSyncConfigurationBusiness.java:145)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.scm.ScmException: Error while executing command.
    at org.apache.maven.scm.provider.git.gitexe.command.GitCommandLineUtils.execute(GitCommandLineUtils.java:122)
    at org.apache.maven.scm.provider.git.gitexe.command.checkin.GitCheckInCommand.executeCheckInCommand(GitCheckInCommand.java:129)
    at org.apache.maven.scm.command.checkin.AbstractCheckInCommand.executeCommand(AbstractCheckInCommand.java:54)
    at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
    ... 14 more
Caused by: org.codehaus.plexus.util.cli.CommandLineException: Error inside systemOut parser
    at org.codehaus.plexus.util.cli.CommandLineUtils$1.call(CommandLineUtils.java:188)
    at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:107)
    at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:74)
    at org.apache.maven.scm.provider.git.gitexe.command.GitCommandLineUtils.execute(GitCommandLineUtils.java:118)
    ... 17 more
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 0: "jobs/ATS%20Testing/config.xml"
    at java.net.URI.create(URI.java:852)
    at org.apache.maven.scm.provider.git.gitexe.command.status.GitStatusConsumer.resolveURI(GitStatusConsumer.java:251)
    at org.apache.maven.scm.provider.git.gitexe.command.status.GitStatusConsumer.resolvePath(GitStatusConsumer.java:232)
    at org.apache.maven.scm.provider.git.gitexe.command.status.GitStatusConsumer.consumeLine(GitStatusConsumer.java:133)
    at org.codehaus.plexus.util.cli.StreamPumper.consumeLine(StreamPumper.java:190)
    at org.codehaus.plexus.util.cli.StreamPumper.run(StreamPumper.java:135)
Caused by: java.net.URISyntaxException: Illegal character in path at index 0: "jobs/ATS%20Testing/config.xml"
    at java.net.URI$Parser.fail(URI.java:2848)
    at java.net.URI$Parser.checkChars(URI.java:3021)
    at java.net.URI$Parser.parseHierarchical(URI.java:3105)
    at java.net.URI$Parser.parse(URI.java:3063)
    at java.net.URI.<init>(URI.java:588)
    at java.net.URI.create(URI.java:850)
    ... 5 more
Zitrax commented 8 years ago

I am seeing the same thing. Affects a lot of our jobs.

falkzilm commented 8 years ago

The same thing applies for user names. We encounter problems there at the moment due to GIT creating users from Commit Messages. So i think it is basically a thing with wrong URI encoding in SCM.

foundatron commented 8 years ago

I'm seeing this as well. Using SCM Sync Configuration Plugin 0.0.9 and Jenkins version 1.642.3.

Despite this bug, this plugin is rad! Thanks!

peterpakos commented 8 years ago

We're being affected by this bug as well.

We get this error when it fails:

screen shot 2016-04-01 at 22 52 29

Any hope for a fix?

@ip2k @Zitrax @foundatron, how do you recover from this?

christau commented 8 years ago

I came across this issue too and found out what the problem is. The error is in the dependency maven-scm-provider-gitexe-1.9.1.jar

Illegal character in path at index 0: "jobs

says it all. The quote at char 0 breaks the whole thing. Meanwhile this has been fixed, but sadly no current release is up (even version 1.9.4 still has the error). I cloned (git://git.apache.org/maven-scm.git), checked out tag 1.9.4 and fixed the error in file GitStatusConsumer.java Then recompiled this lib and pushed it into the plugin scm-sync-configuration.hpi This solved the problem for me.

Attached you find the patch and the precompiled jar, which can be replaced into the hpi file. Also for simplicity I attached the fully patched 0.0.9 of this plugin.

peterpakos commented 8 years ago

@christau, great work, many thanks!

I'll try it out tonight.

mr-martins commented 8 years ago

I have the same error. Job has %2F in name (slash from branch name - multibranch pipeline). I create catalogue from error in checkoutConfiguration and manually commit it. It resolves this problem, but I have to check it with new branches.

rodrigc commented 8 years ago

@christau I sent this request to the Maven developers. Any idea how to push it along?

http://mail-archives.apache.org/mod_mbox/maven-dev/201605.mbox/%3CCAG%3DrPVf6GP3tgXoaAGdru6bQ_CLONo%2BGQUcLPRWpDmP8KqGM7w%40mail.gmail.com%3E

jarmoni commented 8 years ago

Issue has been fixed in this Commit: https://github.com/apache/maven-scm/commit/68eecff6c782e18eb59840205c55d3d1631aa256

Fix should take part in upcoming release of maven-scm. Please update dependency in next release of scm-sync-configuration-plugin.

rodrigc commented 8 years ago

@jarmoni do you know when the release is happening? Last I saw was this: http://www.mail-archive.com/dev@maven.apache.org/msg109252.html

jarmoni commented 8 years ago

@rodrigc No I haven't. I'm not related with maven-scm-team, just saw that issue has been fixed on Friday. I hope it won't take too long. Self-patched plugins in production-environment.....no good!

rodrigc commented 8 years ago

@christau Thanks for identifying the source of the problem. maven-scm-team finally released a new maven-scm-provider-gitexe 1.9.5 plugin. I updated the pom.xml here: https://github.com/jenkinsci/scm-sync-configuration-plugin/commit/63a7401520fcb7d65bacbdd35d8ff6bcb7bd1d80

In my testing, this seems to work. Can you build the plugin and verify that jobs with spaces in their names can now be backed up? I will rebuild the plugin.

@tomaswolf You previously provided this patch https://github.com/jenkinsci/scm-sync-configuration-plugin/commit/2f59c9d08f62e0479b7b6a553967275002dec259 which works around the fact that maven-scm-provider-gitexe had this bug: https://issues.apache.org/jira/browse/SCM-772 How does this fix affect the patch you provided? Is it still needed?

mterzo commented 8 years ago

@rodrigc, I just built a new HPI and i'm able to create and delete jobs with spaces in the name.

rodrigc commented 8 years ago

@mterzo thanks for the feedback. Just to confirm, before the latest patch for SCM-772, were you unable to create/delete jobs with spaces in the name?

mterzo commented 8 years ago

Yeah just checked out master and had no problem.

rodrigc commented 8 years ago

Hopefully https://github.com/jenkinsci/scm-sync-configuration-plugin/commit/a739a54d0c6d65c500245a46b0861cd6f1ba1cbf should fix the problem with Git