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

Quality Gates Sonarqube: projectKey Illegal character

    Details

    • Similar Issues:

      Description

      I need to evaluate a branch in the quality gate, however when configuring the plugin it shows an illegal character error.

       

      stack:

       
      ERROR: Build step failed with exception
      java.net.URISyntaxException: Illegal character in query at index XX:
      http://192.168.0.154:9000/api/ce/component?componentKey=project:origin/homologation
      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:3111)
      at java.net.URI$Parser.parse(URI.java:3053)
      at java.net.URI.<init>(URI.java:588)
      at java.net.URI.create(URI.java:850)
      Caused: java.lang.IllegalArgumentException: Illegal character in query at index XX:
      http://192.168.0.154:9000/api/ce/component?componentKey=project:origin/homologation
      at java.net.URI.create(URI.java:852)
      at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:66)
      at org.quality.gates.sonar.api.SonarHttpRequester.getAPITaskInfo(SonarHttpRequester.java:138)
      at org.quality.gates.sonar.api.QualityGatesProvider.getAPIResultsForQualityGates(QualityGatesProvider.java:63)
      at org.quality.gates.jenkins.plugin.BuildDecision.getStatus(BuildDecision.java:22)
      at org.quality.gates.jenkins.plugin.QGPublisher.perform(QGPublisher.java:84)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:736)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:682)
      at hudson.model.Build$BuildExecution.post2(Build.java:186)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:627)
      at hudson.model.Run.execute(Run.java:1749)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:419)
       

        Attachments

          Activity

          Hide
          arkanjoms Rafael Ramos added a comment -

          Use the variable ${GIT_LOCAL_BRANCH} instead of ${GIT_BRANCH}, and in source code management, section add this option: Check out to specific local branch

          Show
          arkanjoms Rafael Ramos added a comment - Use the variable  ${GIT_LOCAL_BRANCH}  instead of ${GIT_BRANCH}, and in source code management, section add this option:  Check out to specific local branch
          Hide
          leandrolimasi Leandro Lima da Silva added a comment -

          Hi Rafael, 

          it's not working yet. I can't set option for spefic local branch. I'm working with the feature branch flow. Each feature or bug are a new branch. I need the evaluate the branchs in quality gate dynamically.

           

          The error seems to be simple to fix.

           
          Caused: java.lang.IllegalArgumentException: Illegal character in query at index 87:
          http://192.168.0.154:9000/api/ce/component?componentKey=project-name:origin/feature/branch
          at java.net.URI.create(URI.java:852)
          at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:66)
          at org.quality.gates.sonar.api.SonarHttpRequester.getAPITaskInfo(SonarHttpRequester.java:138)
          at org.quality.gates.sonar.api.QualityGatesProvider.getAPIResultsForQualityGates(QualityGatesProvider.java:63)
          at org.quality.gates.jenkins.plugin.BuildDecision.getStatus(BuildDecision.java:22)
          at org.quality.gates.jenkins.plugin.QGPublisher.perform(QGPublisher.java:84)

           

          Can you apply  the "enconding URL" before send to sonar quality gate check in this point? Change the "/" to "%2F" and will works fine.

           

          Thanks for reply

          Show
          leandrolimasi Leandro Lima da Silva added a comment - Hi Rafael,  it's not working yet. I can't set option for spefic local branch. I'm working with the feature branch flow. Each feature or bug are a new branch. I need the evaluate the branchs in quality gate dynamically.   The error seems to be simple to fix.   Caused: java.lang.IllegalArgumentException: Illegal character in query at index 87: http://192.168.0.154:9000/api/ce/component?componentKey=project-name:origin/feature/branch at java.net.URI.create(URI.java:852) at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:66) at org.quality.gates.sonar.api.SonarHttpRequester.getAPITaskInfo(SonarHttpRequester.java:138) at org.quality.gates.sonar.api.QualityGatesProvider.getAPIResultsForQualityGates(QualityGatesProvider.java:63) at org.quality.gates.jenkins.plugin.BuildDecision.getStatus(BuildDecision.java:22) at org.quality.gates.jenkins.plugin.QGPublisher.perform(QGPublisher.java:84)   Can you apply  the "enconding URL" before send to sonar quality gate check in this point? Change the "/" to "%2F" and will works fine.   Thanks for reply
          Hide
          arkanjoms Rafael Ramos added a comment -

          Ok, I'll fix this.

           

          Show
          arkanjoms Rafael Ramos added a comment - Ok, I'll fix this.  
          Hide
          ataylor Alex Taylor added a comment -

          Rafael Ramos Is there a commit or a fix version for this issue? I am not seeing one in the plugin code or linked in this JIRA

          Show
          ataylor Alex Taylor added a comment - Rafael Ramos Is there a commit or a fix version for this issue? I am not seeing one in the plugin code or linked in this JIRA
          Hide
          ataylor Alex Taylor added a comment -

          Rafael Ramos This has been fixed by https://github.com/jenkinsci/quality-gates-plugin/pull/57 if we could get that merged and a new plugin released that would be great

          Show
          ataylor Alex Taylor added a comment - Rafael Ramos This has been fixed by https://github.com/jenkinsci/quality-gates-plugin/pull/57  if we could get that merged and a new plugin released that would be great
          Hide
          arkanjoms Rafael Ramos added a comment -

          Issue opened in wrong component

          Show
          arkanjoms Rafael Ramos added a comment - Issue opened in wrong component
          Hide
          ataylor Alex Taylor added a comment -

          Ivana Sh   Eleni Grozdani Dimitar Pop Dimitrov
           
          We had this issue on the wrong component(we thought it was the Sonar quality gates plugin). Would it be possible to take a look at https://github.com/jenkinsci/quality-gates-plugin/pull/57 and then potentially merge it?
           
          Seems like a quick win

          Show
          ataylor Alex Taylor added a comment - Ivana Sh    Eleni Grozdani Dimitar Pop Dimitrov   We had this issue on the wrong component(we thought it was the Sonar quality gates plugin). Would it be possible to take a look at https://github.com/jenkinsci/quality-gates-plugin/pull/57  and then potentially merge it?   Seems like a quick win

            People

            • Assignee:
              ivanash Ivana Sh
              Reporter:
              leandrolimasi Leandro Lima da Silva
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: