Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-67684

Artifactory Deployment fails with last commit has URL-illegal character in the first line

XMLWordPrintable

      Describe the bug

      Artifactory deployment using the plugin fails with 400 (Bad Request) error. The exact cause might be obscured a little because the plugin performs transactions in parallel, but you will see it. Job and server log excerpts at Additional Context.

      To Reproduce

      Commit to a source repository that will deploy a build to Artifactory, like a main branch to be deployed from a Maven build using the Jenkins Artifactory Plugin, supplying an ASCII double-quote in the first line of the commit message. Semicolon will also trigger the issue. Our Jenkins job used the rtMaven instance in the scripted part of a pipeline, but I suppose the "fill in the web form" Maven integration or Gradle support should exhibit this behavior as well. We used GitHub as the SCM for the repos where we've seen this, but it might be reproducible under Subversion and other source control systems. The important thing is that an ASCII double-quote appear in the commit message summary (first line) so that it shows up as a vcs.message property of the build.

      You will see at least one Failed to upload file message, depending on the number of artifacts to be deployed. For us, it looks like:
       {{[pool-8-thread-1] Deploying artifact: http://na-bos-artifacts.na.tibco.com/ep-snapshots/com/tibco/sandbox/ep/mb/root/1.0.0-SNAPSHOT/root-1.0.0-SNAPSHOT.pom
      [pool-8-thread-2] Deploying artifact: http://na-bos-artifacts.na.tibco.com/ep-snapshots/com/tibco/sandbox/ep/mb/processes/1.0.0-SNAPSHOT/processes-1.0.0-SNAPSHOT.jar
      [Pipeline] }
      [Pipeline] // script
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Declarative: Post Actions)
      [Pipeline] script
      [Pipeline] {
      [Pipeline] step
      INFO: Processing JUnit
      Failed to upload file
      Failed to upload file}}
      Expected behavior
      The artifacts should be deployed.

      Versions

      • Jenkins Artifactory plugin version: 3.15.1
      • Jenkins operating system: Red Hat Enterprise Linux release 8.5 (Ootpa)
      • Artifactory Version: 7.29.7

      Additional context

      Additional Jenkins-side error with backtrace:
       {{java.io.IOException: JFrog service failed. Received 400: <!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1></body></html>
      at org.jfrog.build.extractor.clientConfiguration.client.JFrogService.throwException(JFrogService.java:53)
      at org.jfrog.build.extractor.clientConfiguration.client.artifactory.services.Upload.handleUnsuccessfulResponse(Upload.java:59)
      at org.jfrog.build.extractor.clientConfiguration.client.JFrogService.execute(JFrogService.java:130)
      at org.jfrog.build.extractor.clientConfiguration.client.artifactory.services.Upload.execute(Upload.java:77)
      at org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager.upload(ArtifactoryManager.java:295)
      at org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager.upload(ArtifactoryManager.java:290)
      at org.jfrog.build.extractor.ModuleParallelDeployHelper.lambda$deploy$4(ModuleParallelDeployHelper.java:46)
      Caused: java.lang.RuntimeException: Error occurred while publishing artifact to Artifactory: /mnt/jenkins/workspace/jews_ep-jenkins-multibranch_main/src/pom.xml.
      Skipping deployment of remaining artifacts (if any) and build info.
      at org.jfrog.build.extractor.ModuleParallelDeployHelper.lambda$deploy$4(ModuleParallelDeployHelper.java:57)
      at java.lang.Iterable.forEach(Iterable.java:75)
      at org.jfrog.build.extractor.ModuleParallelDeployHelper.deploy(ModuleParallelDeployHelper.java:44)
      at org.jfrog.build.extractor.ModuleParallelDeployHelper.lambda$null$1(ModuleParallelDeployHelper.java:34)
      at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640)
      Caused: java.util.concurrent.ExecutionException
      at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
      at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
      at org.jfrog.build.extractor.ModuleParallelDeployHelper.deployArtifacts(ModuleParallelDeployHelper.java:36)
      Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to na1devstrje12.dev.tibco.com
      at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1797)
      at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
      at hudson.remoting.Channel.call(Channel.java:1001)
      at hudson.FilePath.act(FilePath.java:1165)
      at hudson.FilePath.act(FilePath.java:1154)
      at org.jfrog.hudson.pipeline.common.types.deployers.Deployer.deployArtifacts(Deployer.java:224)
      at org.jfrog.hudson.pipeline.scripted.steps.DeployStep$Execution.runStep(DeployStep.java:42)
      at org.jfrog.hudson.pipeline.scripted.steps.DeployStep$Execution.runStep(DeployStep.java:30)
      at org.jfrog.hudson.pipeline.ArtifactorySynchronousNonBlockingStepExecution.run(ArtifactorySynchronousNonBlockingStepExecution.java:54)
      at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      Caused: java.lang.RuntimeException
      at org.jfrog.build.extractor.ModuleParallelDeployHelper.deployArtifacts(ModuleParallelDeployHelper.java:38)
      at org.jfrog.hudson.pipeline.common.types.deployers.Deployer$LateDeployCallable.invoke(Deployer.java:364)
      at org.jfrog.hudson.pipeline.common.types.deployers.Deployer$LateDeployCallable.invoke(Deployer.java:335)
      at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3329)
      at hudson.remoting.UserRequest.perform(UserRequest.java:211)
      at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      at hudson.remoting.Request$2.run(Request.java:376)
      at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)}}
      Server-side log excerpt with complaint about encoding: (it's one one line, so scroll to the right):
       {{2022-01-18T14:43:09.651L �[35m[tomct]�[0m [INFO ] [ ] [org.apache.coyote.http11.Http11Processor] [org.apache.coyote.http11.Http11Processor service] - Error parsing HTTP request header
      Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
      java.lang.IllegalArgumentException: Invalid character found in the request target [/artifactory/ep-snapshots/com/tibco/sandbox/ep/mb/root/1.0.0-SNAPSHOT/root-1.0.0-SNAPSHOT.pom;artifactory.licenses=TIBCO;artifactory.licenses=TIBCO;vcs.revision=0471208f1ccf251eb3afffaaa843aa7e4c3ac4aa;vcs.revision=0471208f1ccf251eb3afffaaa843aa7e4c3ac4aa;vcs.revision=0471208f1ccf251eb3afffaaa843aa7e4c3ac4aa;build.timestamp=1642534709469;build.name=Users+::+rkrajews+::+ep-jenkins-multibranch+::+main;build.number=3;vcs.url=https:/github.com/tibcosandbox/ep-jenkins-multibranch.git;vcs.url=https:/github.com/tibcosandbox/ep-jenkins-multibranch.git;vcs.url=https:/github.com/tibcosandbox/ep-jenkins-multibranch.git;vcs.message=Update+copyright.+See+if+"+mark+in+commit+message+header+trips+up+Artifactory+deployment. ]. The valid characters are defined in RFC 7230 and RFC 3986
      at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:517)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:511)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:831)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1651)
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.base/java.lang.Thread.run(Thread.java:829)}}

            eyalbe Eyal Ben Moshe
            rpk_pro Robert
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: