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

Can't configure jenkinsfile in subdirectory

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.60.3
      Bitbucket Branch Source Plugin 2.2.10
      Pipeline: Multibranch 2.16
    • Similar Issues:

      Description

      Problem Description

      If You have Your Jenkinsfile in subdirectory, the result for searching is "Skipped"

      Checking branch feature/JIR-123 from OWNER_1/repo_1
            ‘jenkins/build/my.Jenkinsfile’ not found
          Skipped

      Multibranch Pipeline, mode: Jenkinsfile, Script path: jenkins/build/my.Jenkinsfile

      Probably: BitbucketServerAPIClient.checkPathExists(..)

      String url = UriTemplate
              .fromTemplate(API_BROWSE_PATH)
              .set("owner", "OWNER_1")
              .set("repo", "repo_1")
              .set("path", "jenkins/build/my.Jenkinsfile")
              .set("at", "feature/JIR-123")
              .expand();

      url should contains "/rest/api/1.0/projects/OWNER_1/repos/repo_1/browse/jenkins/build/my.Jenkinsfile?at=feature%2FJIR-123"

      not /rest/api/1.0/projects/OWNER_1/repos/repo_1/browse/jenkins%2Fbuild%2Fmy.Jenkinsfile?at=feature%2FJIR-123

      Proposal for change (but I'm not sure about rules for UriTemplate):

      120: private static final String API_BROWSE_PATH = API_REPOSITORY_PATH + "/browse/{+path}{?at}";

      Or maybe it's a bug in UriTemplate as {/path} is recognized as PATH type.

        Attachments

          Issue Links

            Activity

            Hide
            yairogen Yair Ogen added a comment -

            Cyprian Śniegota I have the same issue. Any workaround?

            Show
            yairogen Yair Ogen added a comment - Cyprian Śniegota I have the same issue. Any workaround?
            Hide
            cyprian Cyprian Śniegota added a comment -
            1. move jenkinsfiles to the main directory
            2. patch sources (one line to change in BitbucketServerAPIClient:120) and build Your version of jenkins plugin until it's fixed in mainstream.

            We choose first one, so I don't have howto for the second.

            Show
            cyprian Cyprian Śniegota added a comment - move jenkinsfiles to the main directory patch sources (one line to change in BitbucketServerAPIClient:120) and build Your version of jenkins plugin until it's fixed in mainstream. We choose first one, so I don't have howto for the second.
            Hide
            yairogen Yair Ogen added a comment -

            option 1 makes sense but something I wanted to avoid

            Show
            yairogen Yair Ogen added a comment - option 1 makes sense but something I wanted to avoid
            Show
            cyprian Cyprian Śniegota added a comment - Created PR https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/111
            Hide
            cyprian Cyprian Śniegota added a comment - - edited

              JENKINS-49295 Similar, but little different solution

            Show
            cyprian Cyprian Śniegota added a comment - - edited   JENKINS-49295 Similar, but little different solution

              People

              • Assignee:
                Unassigned
                Reporter:
                cyprian Cyprian Śniegota
              • Votes:
                5 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: