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

artifacts archiving: add option for treating patterns in case insensitive way

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Similar Issues:

      Description

      It would be nice to have option to search artifacts by pattern in case insensitive way.

        Attachments

          Issue Links

            Activity

            rutsky rutsky created issue -
            mdonohue mdonohue made changes -
            Field Original Value New Value
            Component/s core [ 15593 ]
            Hide
            dominiquebrice Dominique Brice added a comment -

            Could someone provide a detailed scenario to understand the requirement? Which search on which page should provide insensitive search? thx

            Show
            dominiquebrice Dominique Brice added a comment - Could someone provide a detailed scenario to understand the requirement? Which search on which page should provide insensitive search? thx
            Hide
            danielbeck Daniel Beck added a comment -

            Dominique Brice: This is about artifact archiving, a post-build step. You specify an Ant-style pattern like

            **/*.hpi

            and apparently that's case sensitive and no way to make it case insensitive.

            Show
            danielbeck Daniel Beck added a comment - Dominique Brice : This is about artifact archiving, a post-build step. You specify an Ant-style pattern like **/*.hpi and apparently that's case sensitive and no way to make it case insensitive.
            dominiquebrice Dominique Brice made changes -
            Assignee Dominique Brice [ dominiquebrice ]
            dominiquebrice Dominique Brice made changes -
            Attachment CaseInsensitive.png [ 27788 ]
            Attachment CaseSensitive.png [ 27789 ]
            Hide
            dominiquebrice Dominique Brice added a comment -

            I propose to add a checkbox in the "Advanced..." section of the Artifacts Archiving settings, to indicate whether include and exclude patterns should be considered as case sensitive (default, same behavior as today) or case insensitive (new behavior).

            Show
            dominiquebrice Dominique Brice added a comment - I propose to add a checkbox in the "Advanced..." section of the Artifacts Archiving settings, to indicate whether include and exclude patterns should be considered as case sensitive (default, same behavior as today) or case insensitive (new behavior).
            Hide
            danielbeck Daniel Beck added a comment -

            It's consistent with existing UI, so makes sense.

            A few more options and an approach like Git plugin's additional behaviors would make more sense, but that's still off a bit IMO.

            Show
            danielbeck Daniel Beck added a comment - It's consistent with existing UI, so makes sense. A few more options and an approach like Git plugin's additional behaviors would make more sense, but that's still off a bit IMO.
            Hide
            dominiquebrice Dominique Brice added a comment - - edited

            Pull request created.
            (edited to link new pull request, as first one had a merge conflict)

            Show
            dominiquebrice Dominique Brice added a comment - - edited Pull request created. (edited to link new pull request, as first one had a merge conflict)
            Hide
            danielbeck Daniel Beck added a comment -

            Could the suggestion in the second screen shot be improved to suggest the lowercase file name variant? Or too much effort for too little gain?

            Show
            danielbeck Daniel Beck added a comment - Could the suggestion in the second screen shot be improved to suggest the lowercase file name variant? Or too much effort for too little gain?
            Hide
            dominiquebrice Dominique Brice added a comment -

            I think it would be a bit complicated to reconstruct the right pattern with the right case, combining the pattern entered by the user and the files actually found by the DirectoryScanner with case insensitivity.

            An easier (at least it seems easy when I look at the code, haven't tested yet ) and probably as helpful approach would be a message along the way of "*/.HPI doesn't match anything with case sensitivity, but it does with case insensitivity".

            Show
            dominiquebrice Dominique Brice added a comment - I think it would be a bit complicated to reconstruct the right pattern with the right case, combining the pattern entered by the user and the files actually found by the DirectoryScanner with case insensitivity. An easier (at least it seems easy when I look at the code, haven't tested yet ) and probably as helpful approach would be a message along the way of "* / .HPI doesn't match anything with case sensitivity, but it does with case insensitivity".
            Hide
            dominiquebrice Dominique Brice added a comment - - edited

            Some comments about case sensitivity behavior: this feature is based entirely on the behavior of case (in)sensitivity of the org.apache.ant:ant:1.8.3 dependency. In particular AbstractFileSet.setCaseSensitive() and DirectoryScanner.setCaseSensitive() (I was able to find online only the 1.6.1 javadoc but I didn't see any difference with the javadoc of the actual 1.8.3 code). There's not much in the javadoc regarding this flag besides a comment in DirectoryScanner : "Case sensitivity may be turned off if necessary. By default, it is turned on. ".
            Looking at the code it seems that the library ignore the case-sensitivity of the underlying OS. It does its own processing and does not delegate the matching to the OS. The only thing that comes from the OS are the filenames, and the comparisons are made in Java using String.equals() (see for instance code of private method DirectoryScanner.isIncluded()).

            Show
            dominiquebrice Dominique Brice added a comment - - edited Some comments about case sensitivity behavior: this feature is based entirely on the behavior of case (in)sensitivity of the org.apache.ant:ant:1.8.3 dependency. In particular AbstractFileSet.setCaseSensitive() and DirectoryScanner.setCaseSensitive() (I was able to find online only the 1.6.1 javadoc but I didn't see any difference with the javadoc of the actual 1.8.3 code). There's not much in the javadoc regarding this flag besides a comment in DirectoryScanner : "Case sensitivity may be turned off if necessary. By default, it is turned on. ". Looking at the code it seems that the library ignore the case-sensitivity of the underlying OS. It does its own processing and does not delegate the matching to the OS. The only thing that comes from the OS are the filenames, and the comparisons are made in Java using String.equals() (see for instance code of private method DirectoryScanner.isIncluded()).
            Hide
            dominiquebrice Dominique Brice added a comment - - edited

            My testing procedure:

            • on-the-fly validation in job settings
              • create a new job, keep default settings in Artifacts Archiving, enter a valid path: no warning display
              • change some of the valid pattern to opposite case, get a warning message
              • uncheck the "Treat include and exclude patterns as case sensitive" checkbox, warning goes away
              • put the pattern to the correct case again, still no warning
            • actual archiving at build time
              • configure a job with a 'matching' pattern but with incorrect case, uncheck the "case sensitive" option -> artifacts are correctly archived at build time
              • configure a job with a 'matching' pattern but with incorrect case, check the "case sensitive" option -> artifacts are NOT archived at build time
              • configure a job with a matching pattern and correct case, check the "case sensitive" option -> artifacts are correctly archived at build time
              • configure a job with a matching pattern and correct case, uncheck the "case sensitive" option -> artifacts are correctly archived at build time
              • configure a job with a not matching pattern, uncheck the "case sensitive" option -> nothing is archived at build time

            My results:

            • MacOS X (10.9.5, java 1.7.0-45): OK
            • Windows (Windows 7, java 1.7.0-51): OK
            • Linux: I don't have one
            Show
            dominiquebrice Dominique Brice added a comment - - edited My testing procedure: on-the-fly validation in job settings create a new job, keep default settings in Artifacts Archiving, enter a valid path: no warning display change some of the valid pattern to opposite case, get a warning message uncheck the "Treat include and exclude patterns as case sensitive" checkbox, warning goes away put the pattern to the correct case again, still no warning actual archiving at build time configure a job with a 'matching' pattern but with incorrect case, uncheck the "case sensitive" option -> artifacts are correctly archived at build time configure a job with a 'matching' pattern but with incorrect case, check the "case sensitive" option -> artifacts are NOT archived at build time configure a job with a matching pattern and correct case, check the "case sensitive" option -> artifacts are correctly archived at build time configure a job with a matching pattern and correct case, uncheck the "case sensitive" option -> artifacts are correctly archived at build time configure a job with a not matching pattern, uncheck the "case sensitive" option -> nothing is archived at build time My results: MacOS X (10.9.5, java 1.7.0-45): OK Windows (Windows 7, java 1.7.0-51): OK Linux: I don't have one
            dominiquebrice Dominique Brice made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            dominiquebrice Dominique Brice made changes -
            Attachment CaseSensitiveMessage.png [ 27823 ]
            Hide
            dominiquebrice Dominique Brice added a comment -

            Daniel, see new attached screenshot CaseSensitiveMessage.png. It's fairly easy in FilePath.validateAntFileMask() to verify this situation and provide specific feedback to the user.
            There are four others such scenarios that are checked in the code (see lines 2248-2328 in original source code). I added this new check as the first one if there is no match with the exact criteria provided to the users. I'm open to suggestions on whether the case-sensitive/insensitive alternative check should be moved down in this list of checks.

            Show
            dominiquebrice Dominique Brice added a comment - Daniel, see new attached screenshot CaseSensitiveMessage.png. It's fairly easy in FilePath.validateAntFileMask() to verify this situation and provide specific feedback to the user. There are four others such scenarios that are checked in the code (see lines 2248-2328 in original source code ). I added this new check as the first one if there is no match with the exact criteria provided to the users. I'm open to suggestions on whether the case-sensitive/insensitive alternative check should be moved down in this list of checks.
            teilo James Nord made changes -
            Link This issue is related to JENKINS-30721 [ JENKINS-30721 ]
            vvv444 Vasili Galka made changes -
            Link This issue is duplicated by JENKINS-30721 [ JENKINS-30721 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Dominique
            Path:
            core/src/main/java/hudson/FilePath.java
            core/src/main/java/hudson/tasks/ArtifactArchiver.java
            core/src/main/java/hudson/util/FormFieldValidator.java
            core/src/main/resources/hudson/Messages.properties
            core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly
            core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties
            core/src/main/resources/hudson/tasks/ArtifactArchiver/help-caseSensitive.html
            core/src/test/java/hudson/FilePathTest.java
            http://jenkins-ci.org/commit/jenkins/40382c5fc443f1cf1510103d80ec8358bb2f19d1
            Log:
            JENKINS-5253 Allow case insensitive patterns in Artifacts Archiving

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Dominique Path: core/src/main/java/hudson/FilePath.java core/src/main/java/hudson/tasks/ArtifactArchiver.java core/src/main/java/hudson/util/FormFieldValidator.java core/src/main/resources/hudson/Messages.properties core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties core/src/main/resources/hudson/tasks/ArtifactArchiver/help-caseSensitive.html core/src/test/java/hudson/FilePathTest.java http://jenkins-ci.org/commit/jenkins/40382c5fc443f1cf1510103d80ec8358bb2f19d1 Log: JENKINS-5253 Allow case insensitive patterns in Artifacts Archiving
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            core/src/main/java/hudson/FilePath.java
            core/src/main/java/hudson/tasks/ArtifactArchiver.java
            core/src/main/java/hudson/util/FormFieldValidator.java
            core/src/main/resources/hudson/Messages.properties
            core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly
            core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties
            core/src/main/resources/hudson/tasks/ArtifactArchiver/help-caseSensitive.html
            core/src/test/java/hudson/FilePathTest.java
            http://jenkins-ci.org/commit/jenkins/4fd10ed7236cf7322a84f5c8221b5870baab694c
            Log:
            Merge pull request #1429 from dominiquebrice/jenkins-5253b

            JENKINS-5253 Allow case insensitive patterns in Artifacts Archiving

            Compare: https://github.com/jenkinsci/jenkins/compare/c3a68975584d...4fd10ed7236c

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/FilePath.java core/src/main/java/hudson/tasks/ArtifactArchiver.java core/src/main/java/hudson/util/FormFieldValidator.java core/src/main/resources/hudson/Messages.properties core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties core/src/main/resources/hudson/tasks/ArtifactArchiver/help-caseSensitive.html core/src/test/java/hudson/FilePathTest.java http://jenkins-ci.org/commit/jenkins/4fd10ed7236cf7322a84f5c8221b5870baab694c Log: Merge pull request #1429 from dominiquebrice/jenkins-5253b JENKINS-5253 Allow case insensitive patterns in Artifacts Archiving Compare: https://github.com/jenkinsci/jenkins/compare/c3a68975584d...4fd10ed7236c
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            changelog.html
            core/src/test/java/hudson/FilePathTest.java
            http://jenkins-ci.org/commit/jenkins/858849ef42ab2e1da66e1017ca1b6c86fa92c080
            Log:
            Noting JENKINS-5253 from https://github.com/jenkinsci/jenkins/pull/1429

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: changelog.html core/src/test/java/hudson/FilePathTest.java http://jenkins-ci.org/commit/jenkins/858849ef42ab2e1da66e1017ca1b6c86fa92c080 Log: Noting JENKINS-5253 from https://github.com/jenkinsci/jenkins/pull/1429
            Hide
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #4329
            JENKINS-5253 Allow case insensitive patterns in Artifacts Archiving (Revision 40382c5fc443f1cf1510103d80ec8358bb2f19d1)
            Noting JENKINS-5253 from https://github.com/jenkinsci/jenkins/pull/1429 (Revision 858849ef42ab2e1da66e1017ca1b6c86fa92c080)

            Result = SUCCESS
            dominiquebrice : 40382c5fc443f1cf1510103d80ec8358bb2f19d1
            Files :

            • core/src/test/java/hudson/FilePathTest.java
            • core/src/main/java/hudson/util/FormFieldValidator.java
            • core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties
            • core/src/main/java/hudson/FilePath.java
            • core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly
            • core/src/main/resources/hudson/Messages.properties
            • core/src/main/resources/hudson/tasks/ArtifactArchiver/help-caseSensitive.html
            • core/src/main/java/hudson/tasks/ArtifactArchiver.java

            o.v.nenashev : 858849ef42ab2e1da66e1017ca1b6c86fa92c080
            Files :

            • core/src/test/java/hudson/FilePathTest.java
            • changelog.html
            Show
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #4329 JENKINS-5253 Allow case insensitive patterns in Artifacts Archiving (Revision 40382c5fc443f1cf1510103d80ec8358bb2f19d1) Noting JENKINS-5253 from https://github.com/jenkinsci/jenkins/pull/1429 (Revision 858849ef42ab2e1da66e1017ca1b6c86fa92c080) Result = SUCCESS dominiquebrice : 40382c5fc443f1cf1510103d80ec8358bb2f19d1 Files : core/src/test/java/hudson/FilePathTest.java core/src/main/java/hudson/util/FormFieldValidator.java core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties core/src/main/java/hudson/FilePath.java core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly core/src/main/resources/hudson/Messages.properties core/src/main/resources/hudson/tasks/ArtifactArchiver/help-caseSensitive.html core/src/main/java/hudson/tasks/ArtifactArchiver.java o.v.nenashev : 858849ef42ab2e1da66e1017ca1b6c86fa92c080 Files : core/src/test/java/hudson/FilePathTest.java changelog.html
            Hide
            dominiquebrice Dominique Brice added a comment -

            Fix was merged in master branch and is available in Jenkins 1.634 onwards.

            Show
            dominiquebrice Dominique Brice added a comment - Fix was merged in master branch and is available in Jenkins 1.634 onwards.
            dominiquebrice Dominique Brice made changes -
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Resolved [ 5 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 135342 ] JNJira + In-Review [ 186957 ]

              People

              Assignee:
              dominiquebrice Dominique Brice
              Reporter:
              rutsky rutsky
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: