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

Pipeline jobs do not have access to env.BRANCH

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Duplicate
    • gitlab-plugin, pipeline
    • None
    • Jenkins ver. 2.63
      GitLab plugin 1.4.5

    Description

      So, I've already had to abandon multibranch pipelines because they don't get the gitlab variables that I need for my build. Now, I'm working on a regular pipeline and it doesn't have access to the global BRANCH variable.

      So, I can't do pleasant stage conditions like this

      when {
          branch 'master'
      }
      

      I have to write gnarlier conditions

      when {
          environment name: 'gitlabBranch', value: 'master'
      }
      

      Attachments

        Issue Links

          Activity

            anthonymastrean Anthony Mastrean created issue -
            anthonymastrean Anthony Mastrean made changes -
            Field Original Value New Value
            Description So, I've already had to abandon multibranch pipelines because they don't get the gitlab variables that I need for my build. Now, I'm working on a regular pipeline and it doesn't have access to the global BRANCH variable.

             !image-2017-06-29-14-23-14-076.png!

            So, I can't do stage conditions like this

            {code}
            when {
                branch 'master'
            }
            {code}

            I have to write gnarly conditionals

            {code}
            if ${env.gitlabBranch} == 'master' {
                ...
            }
            {code}

            And I'm not even sure if that works in the declarative pipeline syntax yet!
            So, I've already had to abandon multibranch pipelines because they don't get the gitlab variables that I need for my build. Now, I'm working on a regular pipeline and it doesn't have access to the global BRANCH variable.

             !image-2017-06-29-14-23-14-076.png!

            So, I can't do pleasant stage conditions like this

            {code}
            when {
                branch 'master'
            }
            {code}

            I have to write gnarlier conditions

            {code}
            when {
                environment name: 'gitlabBranch', value: 'master'
            }
            {code}

            And I'm not even sure if that works in the declarative pipeline syntax yet!
            anthonymastrean Anthony Mastrean made changes -
            Description So, I've already had to abandon multibranch pipelines because they don't get the gitlab variables that I need for my build. Now, I'm working on a regular pipeline and it doesn't have access to the global BRANCH variable.

             !image-2017-06-29-14-23-14-076.png!

            So, I can't do pleasant stage conditions like this

            {code}
            when {
                branch 'master'
            }
            {code}

            I have to write gnarlier conditions

            {code}
            when {
                environment name: 'gitlabBranch', value: 'master'
            }
            {code}

            And I'm not even sure if that works in the declarative pipeline syntax yet!
            So, I've already had to abandon multibranch pipelines because they don't get the gitlab variables that I need for my build. Now, I'm working on a regular pipeline and it doesn't have access to the global BRANCH variable.

             !image-2017-06-29-14-23-14-076.png!

            So, I can't do pleasant stage conditions like this

            {code}
            when {
                branch 'master'
            }
            {code}

            I have to write gnarlier conditions

            {code}
            when {
                environment name: 'gitlabBranch', value: 'master'
            }
            {code}

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            src/main/java/hudson/remoting/Channel.java
            src/main/java/hudson/remoting/Request.java
            http://jenkins-ci.org/commit/remoting/47b20daa35a2277ca67dc97c0e366cee88d13a9c
            Log:
            JENKINS-45233 - Log errors when Response message cannot be delivered due to the closed channel (#177)

            • [FIXED JENKINS-45223] - Print warnings about failed responses when cannot deliver them due to the closed channel
            • Improve logging of the command execution
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/hudson/remoting/Channel.java src/main/java/hudson/remoting/Request.java http://jenkins-ci.org/commit/remoting/47b20daa35a2277ca67dc97c0e366cee88d13a9c Log: JENKINS-45233 - Log errors when Response message cannot be delivered due to the closed channel (#177) [FIXED JENKINS-45223] - Print warnings about failed responses when cannot deliver them due to the closed channel Improve logging of the command execution JENKINS-45233 - Address comments from @jglick JENKINS-45233 - get rid of gratituos synchronization
            abayer Andrew Bayer made changes -
            Link This issue duplicates JENKINS-45198 [ JENKINS-45198 ]
            abayer Andrew Bayer made changes -
            Resolution Duplicate [ 3 ]
            Status Open [ 1 ] Resolved [ 5 ]
            owenmehegan Owen Mehegan made changes -
            Assignee Robin Müller [ coderhugo ] Owen Mehegan [ owenmehegan ]

            oleg_nenashev, I think you committed with the wrong ticket ID in your message (see above).

            anthonymastrean Anthony Mastrean added a comment - oleg_nenashev , I think you committed with the wrong ticket ID in your message (see above).
            oleg_nenashev Oleg Nenashev added a comment -

            anthonymastrean definitely Sorry about that

            oleg_nenashev Oleg Nenashev added a comment - anthonymastrean definitely Sorry about that

            oleg_nenashev no worries, didn't want you to have bad release notes later

            anthonymastrean Anthony Mastrean added a comment - oleg_nenashev no worries, didn't want you to have bad release notes later

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            src/main/java/hudson/remoting/Channel.java
            src/main/java/hudson/remoting/Request.java
            http://jenkins-ci.org/commit/remoting/b2c6ad1673e37353dd1f5d0e67972a5b1b4151fd
            Log:
            JENKINS-45233 - Log errors when Response message cannot be delivered due to the closed channel (#177)

            • [FIXED JENKINS-45223] - Print warnings about failed responses when cannot deliver them due to the closed channel
            • Improve logging of the command execution
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/hudson/remoting/Channel.java src/main/java/hudson/remoting/Request.java http://jenkins-ci.org/commit/remoting/b2c6ad1673e37353dd1f5d0e67972a5b1b4151fd Log: JENKINS-45233 - Log errors when Response message cannot be delivered due to the closed channel (#177) [FIXED JENKINS-45223] - Print warnings about failed responses when cannot deliver them due to the closed channel Improve logging of the command execution JENKINS-45233 - Address comments from @jglick JENKINS-45233 - get rid of gratituos synchronization

            People

              owenmehegan Owen Mehegan
              anthonymastrean Anthony Mastrean
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: