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

Set an env var with the Bzr rev number in the bzr plugin

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Currently, the bazaar plugin doesn't set an env var like the svn or cvs plugins. Would be really useful. Looks like its just applying this patch

      Index: BazaarSCM.java
      ===================================================================
      --- BazaarSCM.java	(revision 24298)
      +++ BazaarSCM.java	(working copy)
      @@ -%ld,%ld +%ld,%ld @@
       
           @Override
           public void buildEnvVars(AbstractBuild build, Map<String, String> env) {
      +	env.put("BZR_REVISION",this.getRevno().toString())
           }
       
           @Override
      

        Attachments

          Issue Links

            Activity

            cskinfill cskinfill created issue -
            Hide
            lifeless lifeless added a comment -

            Current version of the plugin needs a launcher and workspace to get the revno, so its not quite that easy .

            You can have bzr stash that info in a file when it updates the tree using a hook, if you like, or we can look at what it will take to make buildEnvVars get enough parameters to work,

            Show
            lifeless lifeless added a comment - Current version of the plugin needs a launcher and workspace to get the revno, so its not quite that easy . You can have bzr stash that info in a file when it updates the tree using a hook, if you like, or we can look at what it will take to make buildEnvVars get enough parameters to work,
            lifeless lifeless made changes -
            Field Original Value New Value
            Description Currently, the bazaar plugin doesn't set an env var like the svn or cvs plugins. Would be really useful. Looks like its just applying this patch

            Index: BazaarSCM.java
            ===================================================================
            --- BazaarSCM.java (revision 24298)
            +++ BazaarSCM.java (working copy)
            @@ -%ld,%ld +%ld,%ld @@
             
                 @Override
                 public void buildEnvVars(AbstractBuild build, Map<String, String> env) {
            + env.put("BZR_REVISION",this.getRevno().toString())
                 }
             
                 @Override
            Currently, the bazaar plugin doesn't set an env var like the svn or cvs plugins. Would be really useful. Looks like its just applying this patch
            {noformat}
            Index: BazaarSCM.java
            ===================================================================
            --- BazaarSCM.java (revision 24298)
            +++ BazaarSCM.java (working copy)
            @@ -%ld,%ld +%ld,%ld @@
             
                 @Override
                 public void buildEnvVars(AbstractBuild build, Map<String, String> env) {
            + env.put("BZR_REVISION",this.getRevno().toString())
                 }
             
                 @Override
            {noformat}
            Priority Major [ 3 ] Minor [ 4 ]
            Hide
            x97mdr x97mdr added a comment -

            I would also find this very useful to have. I don't know if its helpful or not but bzr version-info command gives you what you need, you just need to parse the version number out of there.

            Show
            x97mdr x97mdr added a comment - I would also find this very useful to have. I don't know if its helpful or not but bzr version-info command gives you what you need, you just need to parse the version number out of there.
            Hide
            x97mdr x97mdr added a comment -

            Hey all,

            I took the advice of one of the other commenters and added support for BZR_REVISION to the plugin. Find the .patch file attached. I'm a bit of a Java newbie so I hope it's robust enough but essentially I stole a bunch of code from the subversion plugin ... I hope that someone finds this useful and that it makes its way into the official plugin

            Show
            x97mdr x97mdr added a comment - Hey all, I took the advice of one of the other commenters and added support for BZR_REVISION to the plugin. Find the .patch file attached. I'm a bit of a Java newbie so I hope it's robust enough but essentially I stole a bunch of code from the subversion plugin ... I hope that someone finds this useful and that it makes its way into the official plugin
            x97mdr x97mdr made changes -
            Hide
            zigarn Alexandre Garnier added a comment -

            With this patch, the BZR_REVISION env var will be the revno of workspace BEFORE update.

            Would be better to change getRevId in getRevisionState returning a BazaarRevisionState that contains both revno and revid, and when getting 'newid' (newRevisionState) store it into the revision file.

            I'll propose a patch for this one.

            Show
            zigarn Alexandre Garnier added a comment - With this patch, the BZR_REVISION env var will be the revno of workspace BEFORE update. Would be better to change getRevId in getRevisionState returning a BazaarRevisionState that contains both revno and revid, and when getting 'newid' (newRevisionState) store it into the revision file. I'll propose a patch for this one.
            Hide
            zigarn Alexandre Garnier added a comment -

            Here is a patch for that.
            Even better : it extract BZR_REVISION from RevisionState of current build, no need to use a file (build.xml is already there for that)

            It would be nicer to migrate 'rev_id' into 'revId', but I don't know how...

            Show
            zigarn Alexandre Garnier added a comment - Here is a patch for that. Even better : it extract BZR_REVISION from RevisionState of current build, no need to use a file (build.xml is already there for that) It would be nicer to migrate 'rev_id' into 'revId', but I don't know how...
            zigarn Alexandre Garnier made changes -
            Attachment JENKINS-4985.patch [ 19908 ]
            Hide
            zigarn Alexandre Garnier added a comment -
            Show
            zigarn Alexandre Garnier added a comment - github pull request : https://github.com/HudsonLabs/plugin-bazaar/pull/1
            zigarn Alexandre Garnier made changes -
            Assignee trondn [ trondn ] zigarn [ zigarn ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            zigarn Alexandre Garnier made changes -
            Fix Version/s current [ 10162 ]
            Hide
            bretthardin Brett Hardin added a comment -

            This seems to be broken now.

            Show
            bretthardin Brett Hardin added a comment - This seems to be broken now.
            zigarn Alexandre Garnier made changes -
            Link This issue is related to JENKINS-17376 [ JENKINS-17376 ]
            Hide
            zigarn Alexandre Garnier added a comment -

            Pull request link is broken but feature was implemented by commits ec71594 and b95a6ca: BZR_REVID and BZR_REVISION env vars are available.

            Show
            zigarn Alexandre Garnier added a comment - Pull request link is broken but feature was implemented by commits ec71594 and b95a6ca : BZR_REVID and BZR_REVISION env vars are available.
            zigarn Alexandre Garnier made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 135062 ] JNJira + In-Review [ 203234 ]

              People

              Assignee:
              zigarn Alexandre Garnier
              Reporter:
              cskinfill cskinfill
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: