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

URL formatting exception doing Bitbucket requests

    XMLWordPrintable

Details

    Description

      Seems the change to the URL encoding causes problems when Git branch names contains slash. Branch name "feature/swagger_update" causes the below exception very early in the build.

      [Bitbucket] Build result notified
      java.util.UnknownFormatConversionException: Conversion = 'F'
      	at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2691)
      	at java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2720)
      	at java.util.Formatter.parse(Formatter.java:2560)
      	at java.util.Formatter.format(Formatter.java:2501)
      	at java.util.Formatter.format(Formatter.java:2455)
      	at java.lang.String.format(String.java:2940)
      	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getFileContent(BitbucketServerAPIClient.java:722)
      	at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:81)
      	at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:338)
      	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:104)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:263)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:421)

      This could maybe be cause by: https://github.com/jenkinsci/bitbucket-branch-source-plugin/commit/e75532a07cadc108936c12cf81b19582be24f332

      Downgrading to 2.2.5 solves the problem.

      Attachments

        Issue Links

          Activity

            mindrunner Lukas Elsner added a comment -

            +1

            mindrunner Lukas Elsner added a comment - +1

            Just an addition.

            The URL of the job was http://<domain>/job/NIN/job/darwin-service/job/feature%252Fswagger_update/

            It seems the 'F' ends up being part of the String.format() invocation.

            langecode Thor Anker Kvisgård Lange added a comment - Just an addition. The URL of the job was http://<domain>/job/NIN/job/darwin-service/job/feature%252Fswagger_update/ It seems the 'F' ends up being part of the String.format() invocation.
            vivek Vivek Pandey added a comment - Already fixed in https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/83 . Please try 2.2.7.

            vivek Problem is still there in 2.2.7. 

             

             

            ERROR: Could not do lightweight checkout, falling back to heavyweight java.io.FileNotFoundException: URL:
            https://api.bitbucket.org/2.0/repositories/examplecompany/somerepo/src/feature%2FMYGO-1526/Jenkinsfile
            at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRequestAsInputStream(BitbucketCloudApiClient.java:558) at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getFileContent(BitbucketCloudApiClient.java:719) at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:81) at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:338) at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:104) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:262) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429)
            

             

             

            grevenx Even André Fiskvik added a comment - vivek Problem is still there in 2.2.7.      ERROR: Could not do lightweight checkout, falling back to heavyweight java.io.FileNotFoundException: URL: https: //api.bitbucket.org/2.0/repositories/examplecompany/somerepo/src/feature%2FMYGO-1526/Jenkinsfile at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRequestAsInputStream(BitbucketCloudApiClient.java:558) at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getFileContent(BitbucketCloudApiClient.java:719) at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:81) at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:338) at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:104) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:262) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429)    
            jvh Johan Van Hoye added a comment - - edited

            I have the same error message and still so with the latest Bitbucket Branch Source Plugin v.2.2.7, but it looks like it's coming from a slightly different source.

            In my multibranch job setup, the Jenkinsfile is configured to reside in a subfolder, not in the repo's root.

            Project Recognizers
            Pipeline Jenkinsfile  
              Script Path  config/Jenkinsfile

            Notice a slash is now in the configuration path of the Jenkinsfile and not in the branchname. While the Jenkinsfile gets picked up and executed correctly, I always seem to be getting this error at the beginning of any build log:

            Started by user Jenkins
            ERROR: Could not do lightweight checkout, falling back to heavyweight
            java.io.FileNotFoundException: URL: https://api.bitbucket.org/2.0/repositories/mycompany/myrepo/src/branchname/configJenkinsfile/
            	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRequestAsInputStream(BitbucketCloudApiClient.java:558)
            	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getFileContent(BitbucketCloudApiClient.java:719)
            	at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:81)
            	at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:338)
            	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:104)
            	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:262)
            	at hudson.model.ResourceController.execute(ResourceController.java:97)
            	at hudson.model.Executor.run(Executor.java:421)
            

            The configured slash between "config" and "Jenkinsfile" has disappeared, causing a file not found exception.

            jvh Johan Van Hoye added a comment - - edited I have the same error message and still so with the latest Bitbucket Branch Source Plugin v.2.2.7, but it looks like it's coming from a slightly different source. In my multibranch job setup, the Jenkinsfile is configured to reside in a subfolder, not in the repo's root. Project Recognizers Pipeline Jenkinsfile     Script Path   config / Jenkinsfile Notice a slash is now in the configuration path of the Jenkinsfile and not in the branchname. While the Jenkinsfile gets picked up and executed correctly, I always seem to be getting this error at the beginning of any build log: Started by user Jenkins ERROR: Could not do lightweight checkout, falling back to heavyweight java.io.FileNotFoundException: URL: https://api.bitbucket.org/2.0/repositories/mycompany/myrepo/src/branchname/configJenkinsfile/ at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRequestAsInputStream(BitbucketCloudApiClient.java:558) at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getFileContent(BitbucketCloudApiClient.java:719) at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:81) at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:338) at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:104) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:262) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:421) The configured slash between "config" and "Jenkinsfile" has disappeared, causing a file not found exception.
            kit Kit Plummer added a comment -

            We're seeing the same issue.  It's JIRA's prefix-ing of branches for us - so with a 'bugfix' that gets prepended to the branch name.  We're using 2.2.11 of the plugin.

             
            java.util.UnknownFormatConversionException: Conversion = 'F'
            at java.util.Formatter$FormatSpecifier.conversion(Unknown Source)
            at java.util.Formatter$FormatSpecifier.<init>(Unknown Source)
            at java.util.Formatter.parse(Unknown Source)
            at java.util.Formatter.format(Unknown Source)
            at java.util.Formatter.format(Unknown Source)

            kit Kit Plummer added a comment - We're seeing the same issue.  It's JIRA's prefix-ing of branches for us - so with a 'bugfix' that gets prepended to the branch name.  We're using 2.2.11 of the plugin.   java.util.UnknownFormatConversionException: Conversion = 'F' at java.util.Formatter$FormatSpecifier.conversion(Unknown Source) at java.util.Formatter$FormatSpecifier.<init>(Unknown Source) at java.util.Formatter.parse(Unknown Source) at java.util.Formatter.format(Unknown Source) at java.util.Formatter.format(Unknown Source)

            People

              Unassigned Unassigned
              langecode Thor Anker Kvisgård Lange
              Votes:
              5 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: