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

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

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: