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

readTrusted Pipeline from SCM only works in */master

    XMLWordPrintable

Details

    Description

      Using a branch with Pipeline from SCM breaks readTrusted. The following snippet only works from */master and not */bugfix/break-readTrusted. See https://github.com/initialzero/jenkins-break-readtrusted.git with branch and pipeline from scm.

      #!groovy
      node {
       stage('test') {
        def trustedText = readTrusted 'foo.properties'
        echo trustedText
       }
      }
      

       

      Error message from Jenkins is:

      ERROR: ‘readTrusted’ is only available when using “Multibranch Pipeline” or “Pipeline script from SCM”

      Attachments

        Issue Links

          Activity

            initialzero Marc Benstein created issue -
            initialzero Marc Benstein made changes -
            Field Original Value New Value
            Description Using a branch with Pipeline from SCM breaks readTrusted. The following snippet only works from */master and not */bugfix/break-readTrusted. See [https://github.com/initialzero/jenkins-break-readtrusted.git] with branch and pipeline from scm.
            {code:java}
            #!groovy
            node {
             stage('test') {
              def trustedText = readTrusted 'foo.properties'
              echo trustedText
             }
            }
            {code}
             
            Using a branch with Pipeline from SCM breaks readTrusted. The following snippet only works from */master and not */bugfix/break-readTrusted. See [https://github.com/initialzero/jenkins-break-readtrusted.git] with branch and pipeline from scm.
            {code:java}
            #!groovy
            node {
             stage('test') {
              def trustedText = readTrusted 'foo.properties'
              echo trustedText
             }
            }
            {code}
             

            Error message from Jenkins is:

            ERROR: ‘readTrusted’ is only available when using “Multibranch Pipeline” or “Pipeline script from SCM”
            initialzero Marc Benstein made changes -
            Priority Minor [ 4 ] Major [ 3 ]
            initialzero Marc Benstein made changes -
            Component/s workflow-multibranch-plugin [ 21465 ]
            Component/s pipeline-multibranch-defaults-plugin [ 21926 ]
            initialzero Marc Benstein made changes -
            Assignee Denis Saponenko [ vaimr ] Andrew Bayer [ abayer ]
            initialzero Marc Benstein made changes -
            Assignee Andrew Bayer [ abayer ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-31386 [ JENKINS-31386 ]
            jglick Jesse Glick added a comment -

            Prevents JENKINS-31386 from working; seems to have regressed from JENKINS-33273 fix.

            jglick Jesse Glick added a comment - Prevents  JENKINS-31386 from working; seems to have regressed from  JENKINS-33273 fix.
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-33273 [ JENKINS-33273 ]
            jglick Jesse Glick made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Component/s git-plugin [ 15543 ]
            jglick Jesse Glick added a comment -

            There are actually two bugs here. readTrusted was not working correctly with CpsScmFlowDefinition when the SCM plugin forced a heavyweight checkout. And the Git plugin was needlessly blocking lightweight checkouts when setting a branch on a checkout, because this code is too strict: does not match */x/y as a refspec.

            jglick Jesse Glick added a comment - There are actually two bugs here. readTrusted was not working correctly with CpsScmFlowDefinition when the SCM plugin forced a heavyweight checkout. And the Git plugin was needlessly blocking lightweight checkouts when setting a branch on a checkout, because this code is too strict: does not match */x/y as a refspec.
            jglick Jesse Glick made changes -
            Assignee Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-multibranch PR 67 (Web Link)" [ 17395 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "git PR 519 (Web Link)" [ 17396 ]
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/multibranch/ReadTrustedStep.java
            src/test/java/org/jenkinsci/plugins/workflow/multibranch/ReadTrustedStepTest.java
            http://jenkins-ci.org/commit/workflow-multibranch-plugin/60417b6017779aaf4ebd5d75e25039edca4f27ec
            Log:
            JENKINS-42817 readTrusted was producing a misleading error when using CpsScmFlowDefinition on an SCM rejecting lightweight checkouts.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/multibranch/ReadTrustedStep.java src/test/java/org/jenkinsci/plugins/workflow/multibranch/ReadTrustedStepTest.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/60417b6017779aaf4ebd5d75e25039edca4f27ec Log: JENKINS-42817 readTrusted was producing a misleading error when using CpsScmFlowDefinition on an SCM rejecting lightweight checkouts.

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/multibranch/ReadTrustedStep.java
            src/test/java/org/jenkinsci/plugins/workflow/multibranch/ReadTrustedStepTest.java
            http://jenkins-ci.org/commit/workflow-multibranch-plugin/c49261f827d032a637475071ba6742f0c40a8653
            Log:
            Merge pull request #67 from jglick/readTrusted-heavyweight-JENKINS-42817

            JENKINS-42817 readTrusted broke with CpsScmFlowDefinition & heavyweight checkouts

            Compare: https://github.com/jenkinsci/workflow-multibranch-plugin/compare/f261fb4772e4...c49261f827d0

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/org/jenkinsci/plugins/workflow/multibranch/ReadTrustedStep.java src/test/java/org/jenkinsci/plugins/workflow/multibranch/ReadTrustedStepTest.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/c49261f827d032a637475071ba6742f0c40a8653 Log: Merge pull request #67 from jglick/readTrusted-heavyweight- JENKINS-42817 JENKINS-42817 readTrusted broke with CpsScmFlowDefinition & heavyweight checkouts Compare: https://github.com/jenkinsci/workflow-multibranch-plugin/compare/f261fb4772e4...c49261f827d0
            jglick Jesse Glick made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            markewaite Mark Waite added a comment -

            Included in git plugin 3.5.1 released 5 Aug 2017

            markewaite Mark Waite added a comment - Included in git plugin 3.5.1 released 5 Aug 2017
            initialzero Marc Benstein added a comment -

            Please review this again. I am still unable to use branches with readTrusted. Current git plugin version is 3.5.1.

            initialzero Marc Benstein added a comment - Please review this again. I am still unable to use branches with readTrusted. Current git plugin version is 3.5.1.
            initialzero Marc Benstein made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            jglick Jesse Glick added a comment -

            initialzero the reproduced issue was fixed with tests. If you are still having problems, either you are not actually running the fix versions, or you have some other bug—in which case file a new report with complete steps to reproduce from scratch and link to this one.

            jglick Jesse Glick added a comment - initialzero the reproduced issue was fixed with tests. If you are still having problems, either you are not actually running the fix versions, or you have some other bug—in which case file a new report with complete steps to reproduce from scratch and link to this one.
            jglick Jesse Glick made changes -
            Resolution Fixed [ 1 ]
            Status Reopened [ 4 ] Resolved [ 5 ]
            markewaite Mark Waite made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

            People

              jglick Jesse Glick
              initialzero Marc Benstein
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: