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

Quality Gates Sonarqube: projectKey Illegal character

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • quality-gates-plugin
    • None
    • Jenkins ver. 2.78

      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)
       

          [JENKINS-47321] Quality Gates Sonarqube: projectKey Illegal character

          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

          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

          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

          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

          Rafael Ramos added a comment -

          Ok, I'll fix this.

           

          Rafael Ramos added a comment - Ok, I'll fix this.  

          Alex Taylor added a comment -

          arkanjoms 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

          Alex Taylor added a comment - arkanjoms 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

          Alex Taylor added a comment -

          arkanjoms 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

          Alex Taylor added a comment - arkanjoms 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

          Rafael Ramos added a comment -

          Issue opened in wrong component

          Rafael Ramos added a comment - Issue opened in wrong component

          Alex Taylor added a comment -

          ivanash   egrozdani dpd90
           
          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

          Alex Taylor added a comment - ivanash    egrozdani dpd90   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

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

              Created:
              Updated: