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

Not correct exclude path to domains

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I am using the Credential plugin for Jenkins, and I think I have detected a bug.

      I am going to explain the steps I have followed .(sorry for my English

      1. First, I create the domain and exclude the path XXXX
         
      2. Second, I created the credentials for my user inside this domain
         
      3. Then, I configure the job, pasting the url repo.
      4. And the credentials show me jsanchra and None values. I guess the Credentials only should show None value, is that correct? Maybe I have a configuration mistake?

        Attachments

        1. credential-exclusion-a-01.PNG
          credential-exclusion-a-01.PNG
          35 kB
        2. credential-exclusion-b-01.PNG
          credential-exclusion-b-01.PNG
          35 kB
        3. credentials-exclusion-a-02.png
          credentials-exclusion-a-02.png
          27 kB
        4. credentials-exclusion-a-03.png
          credentials-exclusion-a-03.png
          19 kB
        5. credentials-exclusion-b-02.png
          credentials-exclusion-b-02.png
          24 kB
        6. credentials-exclusion-b-03.png
          credentials-exclusion-b-03.png
          17 kB
        7. image1.png
          image1.png
          37 kB
        8. image2.png
          image2.png
          19 kB
        9. image3.png
          image3.png
          28 kB
        10. image5.png
          image5.png
          10 kB
        11. image6.png
          image6.png
          20 kB

          Issue Links

            Activity

            Hide
            stephenconnolly Stephen Connolly added a comment -

            So you have not supplied a wildcard on the path, which means that you are excluding only the EXACT path /git/STEPS/ try changing your exclude path to /git/STEPS/**

            Show
            stephenconnolly Stephen Connolly added a comment - So you have not supplied a wildcard on the path, which means that you are excluding only the EXACT path /git/STEPS/ try changing your exclude path to /git/STEPS/**
            Hide
            stephenconnolly Stephen Connolly added a comment -

            Marking as not a defect as I suspect it is a configuration error on your side. Please re-open if my suggestion does not resolve the issue for you. Please close if my suggestion did fix

            Show
            stephenconnolly Stephen Connolly added a comment - Marking as not a defect as I suspect it is a configuration error on your side. Please re-open if my suggestion does not resolve the issue for you. Please close if my suggestion did fix
            Hide
            jsanchra juan francisco sanchez ramos added a comment - - edited

            Hi stephen

            Change exclude to /git/STEPS/** in the same problem :

             

            • image 5

            and show credentials :

            • image 6

             

            Thanks

            Show
            jsanchra juan francisco sanchez ramos added a comment - - edited Hi stephen Change exclude to /git/STEPS/ ** in the same problem :   image 5 and show credentials : image 6   Thanks
            Hide
            stephenconnolly Stephen Connolly added a comment -

            This is a bug in the git-client plugin.

            https://github.com/jenkinsci/git-client-plugin/blob/master/src/main/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilder.java#L189

            Does not generate PathRequirement information at all

            Show
            stephenconnolly Stephen Connolly added a comment - This is a bug in the git-client plugin. https://github.com/jenkinsci/git-client-plugin/blob/master/src/main/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilder.java#L189 Does not generate PathRequirement information at all
            Hide
            stephenconnolly Stephen Connolly added a comment -

            NOTE: The credentials plugin's helper for generating requirements does supply the path requirement: https://github.com/jenkinsci/credentials-plugin/blob/master/src/main/java/com/cloudbees/plugins/credentials/domains/URIRequirementBuilder.java#L101

            Show
            stephenconnolly Stephen Connolly added a comment - NOTE: The credentials plugin's helper for generating requirements does supply the path requirement:  https://github.com/jenkinsci/credentials-plugin/blob/master/src/main/java/com/cloudbees/plugins/credentials/domains/URIRequirementBuilder.java#L101
            Hide
            jsanchra juan francisco sanchez ramos added a comment -

            something new? Stephen Connolly or Mark Waite ? .

             

            Thanks

            Show
            jsanchra juan francisco sanchez ramos added a comment - something new? Stephen Connolly or Mark Waite ? .   Thanks
            Hide
            markewaite Mark Waite added a comment -

            Nothing new. Other items are currently higher priority. I'd love to have additional help with the plugin. If you're able to propose a pull request for the plugin, it tends to proceed more quickly than if I do it.

            Show
            markewaite Mark Waite added a comment - Nothing new. Other items are currently higher priority. I'd love to have additional help with the plugin. If you're able to propose a pull request for the plugin, it tends to proceed more quickly than if I do it.
            Hide
            jsanchra juan francisco sanchez ramos added a comment -

            ok Mark Waite , the correct url to pull request is https://github.com/jenkinsci/credentials-plugin or https://github.com/jenkinsci/git-plugin ?

            Thanks

            p.d: We will seek all possible ways

             

            Show
            jsanchra juan francisco sanchez ramos added a comment - ok Mark Waite , the correct url to pull request is https://github.com/jenkinsci/credentials-plugin  or https://github.com/jenkinsci/git-plugin  ? Thanks p.d: We will seek all possible ways  
            Hide
            markewaite Mark Waite added a comment -

            The git client plugin is likely where the change will be needed.

            Show
            markewaite Mark Waite added a comment - The git client plugin is likely where the change will be needed.
            Hide
            jsanchra juan francisco sanchez ramos added a comment -

            Hello Mark Waite

            Many people see this interest in this problem, can be prioritized ?.

            Thank you

            Show
            jsanchra juan francisco sanchez ramos added a comment - Hello Mark Waite Many people see this interest in this problem, can be prioritized ?. Thank you
            Hide
            markewaite Mark Waite added a comment -

            It is assigned to me. My time to look at bugs is limited while I search for employment (recently laid off by my current employer). This bug and the two submodule configuration bugs are the top of my current list.

            Show
            markewaite Mark Waite added a comment - It is assigned to me. My time to look at bugs is limited while I search for employment (recently laid off by my current employer). This bug and the two submodule configuration bugs are the top of my current list.
            Hide
            jsanchra juan francisco sanchez ramos added a comment -

            Ok thanks Mark Waite !

            Show
            jsanchra juan francisco sanchez ramos added a comment - Ok thanks Mark Waite !
            Hide
            jsanchra juan francisco sanchez ramos added a comment -

            Hi, Mark Waite , something new?

            thanks

            Show
            jsanchra juan francisco sanchez ramos added a comment - Hi,  Mark Waite , something new? thanks
            Hide
            markewaite Mark Waite added a comment -

            Nothing new to report. I'm preparing releases of the git client plugin and git plugin which will not include any change for this. Once that is done, I'll investigate the submodule issues and this bug.

            Show
            markewaite Mark Waite added a comment - Nothing new to report. I'm preparing releases of the git client plugin and git plugin which will not include any change for this. Once that is done, I'll investigate the submodule issues and this bug.
            Hide
            jsanchra juan francisco sanchez ramos added a comment -

            Hi Mark Waite

            Any news about the incidence?

            I am looking to help you to speed up this problem, could you give me some reference of which classes to modify ?.

            Thank you

            Show
            jsanchra juan francisco sanchez ramos added a comment - Hi Mark Waite Any news about the incidence? I am looking to help you to speed up this problem, could you give me some reference of which classes to modify ?. Thank you
            Hide
            markewaite Mark Waite added a comment -

            I've nothing new to report. I suspect the change needs a review of all locations in the git client plugin which refer to a credential, including the user interface portions and CliGitAPIImpl and JGitAPIImpl.

            Show
            markewaite Mark Waite added a comment - I've nothing new to report. I suspect the change needs a review of all locations in the git client plugin which refer to a credential, including the user interface portions and CliGitAPIImpl and JGitAPIImpl.
            Hide
            jsanchra juan francisco sanchez ramos added a comment -

            Hi Mark Waite this solution to pull request : https://github.com/jenkinsci/git-client-plugin/pull/242 , tested my local and good working.

            Please you feedback to solution.

            Thanks

            Show
            jsanchra juan francisco sanchez ramos added a comment - Hi Mark Waite this solution to pull request : https://github.com/jenkinsci/git-client-plugin/pull/242  , tested my local and good working. Please you feedback to solution. Thanks
            Hide
            markewaite Mark Waite added a comment - - edited

            juan francisco sanchez ramos I've tested the pull request and it doesn't behave the way I'd expected.

            I duplicated the bug by defining a GitHub credential in the lts-with-plugins branch of my docker instance with hostname github.com, URI scheme https, and URI path exclusion /MarkEWaite/jenkins-bugs-private* . When I open the job definition and select the credentials dropdown, it (incorrectly) shows the excluded credential, in addition to the matching credentials.  That's the bug.

            When I merged your pull request onto a development branch based on the master branch with your changes, when I open the job definition and select the credentials dropdown, it (incorrectly) shows the excluded credential, in addition to the matching credentials. That's good.

            Unfortunately, when I configure a job which should still show the credential, it does not show the credential. It is as though your changes have caused that credential to be hidden in all cases.

            Before your Changes

            Define the credential:

            See the credential (unexpected):

            See the credential (expected)

            After your Changes

            Define the credential:

            Don't see the credential (as expected)

            Don't see the credential (unexpected)

            Show
            markewaite Mark Waite added a comment - - edited juan francisco sanchez ramos I've tested the pull request and it doesn't behave the way I'd expected. I duplicated the bug by defining a GitHub credential in the lts-with-plugins branch of my docker instance with hostname github.com , URI scheme https , and URI path exclusion /MarkEWaite/jenkins-bugs-private* . When I open the job definition and select the credentials dropdown, it (incorrectly) shows the excluded credential, in addition to the matching credentials.  That's the bug. When I merged your pull request onto a development branch based on the master branch with your changes, when I open the job definition and select the credentials dropdown, it (incorrectly) shows the excluded credential, in addition to the matching credentials. That's good. Unfortunately, when I configure a job which should still show the credential, it does not show the credential. It is as though your changes have caused that credential to be hidden in all cases. Before your Changes Define the credential: See the credential (unexpected): See the credential (expected) After your Changes Define the credential: Don't see the credential (as expected) Don't see the credential (unexpected)
            Hide
            jsanchra juan francisco sanchez ramos added a comment -

            Hi Mark Waite the problem es .git, ok i review this case.

            Thanks

            Show
            jsanchra juan francisco sanchez ramos added a comment - Hi Mark Waite the problem es .git, ok i review this case. Thanks
            Hide
            markewaite Mark Waite added a comment -

            juan francisco sanchez ramos I revised your pull request to reduce differences to the upstream master, and to add more tests, and have submitted it as a new pull request. It has passed my interactive testing. I've requested a review from Stephen Connolly to confirm that it behaves the way he expects.

            I found one surprise in relative path scp style URL's which is documented in the source code. If a user wants to apply an exclusion to a relative path scp URL (like mwaite@git.markwaite.net:git/bare/bin.git), then they must prefix the relative path with a '/' so that the exclusion is applied. The credentials Path component prefixes with a '/' if one is not detected in the string already. That credentials code is likely used in many places, so I believe that changing that behavior would be much worse than requiring users to make this minor adaptation.

            Show
            markewaite Mark Waite added a comment - juan francisco sanchez ramos I revised your pull request to reduce differences to the upstream master, and to add more tests, and have submitted it as a new pull request . It has passed my interactive testing. I've requested a review from Stephen Connolly to confirm that it behaves the way he expects. I found one surprise in relative path scp style URL's which is documented in the source code. If a user wants to apply an exclusion to a relative path scp URL (like mwaite@git.markwaite.net:git/bare/bin.git), then they must prefix the relative path with a '/' so that the exclusion is applied. The credentials Path component prefixes with a '/' if one is not detected in the string already. That credentials code is likely used in many places, so I believe that changing that behavior would be much worse than requiring users to make this minor adaptation.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: juan francisco sanchez
            Path:
            src/main/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilder.java
            src/test/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilderTest.java
            http://jenkins-ci.org/commit/git-client-plugin/a865e011e91050bc074b319f656436c3b7d88c13
            Log:
            JENKINS-43022 - Honor git credential path exclusion and inclusion

            Tests scp URL form in GitURIRequirementsBuilderTest

            Adds assertions for path.getPath(), including incorrect relative scp path.

            Credentials PathRequirement incorrectly converts relative path to
            absolute path. Adapt the test to that error, since PathRequirement
            is likely used in many other cases where the prefixing of a '/' to the
            relative path is the expected and desired behavior.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: juan francisco sanchez Path: src/main/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilder.java src/test/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilderTest.java http://jenkins-ci.org/commit/git-client-plugin/a865e011e91050bc074b319f656436c3b7d88c13 Log: JENKINS-43022 - Honor git credential path exclusion and inclusion Tests scp URL form in GitURIRequirementsBuilderTest Adds assertions for path.getPath(), including incorrect relative scp path. Credentials PathRequirement incorrectly converts relative path to absolute path. Adapt the test to that error, since PathRequirement is likely used in many other cases where the prefixing of a '/' to the relative path is the expected and desired behavior.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Mark Waite
            Path:
            src/main/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilder.java
            src/test/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilderTest.java
            http://jenkins-ci.org/commit/git-client-plugin/3ba074ccee0e9677e1f0431349c3e069206675dc
            Log:
            Merge pull request #249 from MarkEWaite/master-PR242-credentials-exclude-path

            JENKINS-43022 - Honor git credential path exclusion and inclusion

            Compare: https://github.com/jenkinsci/git-client-plugin/compare/eef4e1d17fef...3ba074ccee0e

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilder.java src/test/java/org/jenkinsci/plugins/gitclient/GitURIRequirementsBuilderTest.java http://jenkins-ci.org/commit/git-client-plugin/3ba074ccee0e9677e1f0431349c3e069206675dc Log: Merge pull request #249 from MarkEWaite/master-PR242-credentials-exclude-path JENKINS-43022 - Honor git credential path exclusion and inclusion Compare: https://github.com/jenkinsci/git-client-plugin/compare/eef4e1d17fef...3ba074ccee0e
            Hide
            markewaite Mark Waite added a comment - - edited

            Will be included in the next release of the git client plugin. A pre-release build is available from the last stable build of the git client plugin

            Show
            markewaite Mark Waite added a comment - - edited Will be included in the next release of the git client plugin. A pre-release build is available from the last stable build of the git client plugin
            Hide
            jsanchra juan francisco sanchez ramos added a comment -

            Thanks Mark Waite , sorry to solvent your detected issue. I've been overworked lately

            Thanks man!!

            Show
            jsanchra juan francisco sanchez ramos added a comment - Thanks Mark Waite , sorry to solvent your detected issue. I've been overworked lately Thanks man!!
            Hide
            markewaite Mark Waite added a comment -

            Git client plugin 2.5.0 released 27 Jul 2017 includes this fix

            Show
            markewaite Mark Waite added a comment - Git client plugin 2.5.0 released 27 Jul 2017 includes this fix

              People

              Assignee:
              markewaite Mark Waite
              Reporter:
              jsanchra juan francisco sanchez ramos
              Votes:
              15 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: