Hudson build tracking in Mercurial Repo

I am working on creating a Hudson / Mercurial stack for development. One of the use cases that I have is "As a developer, I want to update my local sandbox to a specific build number from Hudson, so I can [fix the error, debugging problems, create a forked version of the code, etc.]. "

So, if I see build 49 on Hudson, how do I upgrade the local Mercurial repository to the same source code that was used for build # 49?

Note. I looked at the Mercurial tags, however they do not seem to be quite suitable. They require a commit, so it seems that commits will pollute the history (each commit by the developer will show the subsequent commit from the tag operation). If this is best, I think I will have to live with him, but hoping for something better. They will probably still use tags for releases.

+4
source share
2 answers

Ok, here is the solution where I ended up:

Using the Description Setter plugin, I set the description of successful and unsuccessful builds to "Mercurial $ {MERCURIAL_REVISION}". It turns out that the current Mercurial SCM plugin sets this environment variable to the identifier of the parent change set.

Then I can look at the build on Hudson, and if necessary, take the change set identifier and do an β€œhg update” on my local repo to get this revision of the code.

Please note that in the Mercurial plugin tracker there is some talk about changing this parameter with HG_REVISION and adding other environment variables, so at some point this may break, but it works for me for now.

+4
source

You can use the hudson keyword extension to update the node in some aspect of the assembly, possibly including artifact names. If your Hudson job artifacts are similar to: myproject-2010-02-17-2dbf7575fa46.tar.gz, you probably know how to "update hg" to this point.

Keyword expansion and maybe a little ant-fu make it easy.

+1
source

Source: https://habr.com/ru/post/1301655/


All Articles