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

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

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • bazaar-plugin
    • None

      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
      

          [JENKINS-4985] Set an env var with the Bzr rev number in the bzr plugin

          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 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,

          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.

          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.

          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 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

          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.

          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.

          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...

          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...

          Alexandre Garnier added a comment - github pull request : https://github.com/HudsonLabs/plugin-bazaar/pull/1

          Brett Hardin added a comment -

          This seems to be broken now.

          Brett Hardin added a comment - This seems to be broken now.

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

          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
            cskinfill cskinfill
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: