Running a build with a temporary build parameter when pinned
I am trying to build a server side plugin that will re-run a build when it is pinned. However, I don't want to just rerun exactly the same build, I want to add a specific build parameter to that execution of the build. I know that I need to extend the BuildServerAdapter and implement the buildPinned() method. I have also figured out a way to create a new build parameter for the build type, however, that new parameter becomes persistent on the build configuration. I do not want it to be persistent, just to be applicable only for that one run of the build. This is what I have so far:
public void buildPinned(SBuild sBuild, User user, String s) {
List<String> tags = sBuild.getTags();
if (tags.contains("ReleaseCandidate")) {
BuildPromotion buildPromotion = sBuild.getBuildPromotion().copy(true);
SBuildType buildConfig = buildPromotion.getBuildType();
buildConfig.addBuildParameter(new SimpleParameter("release-build", "true"));
buildPromotion.addToQueue("myuser");
}
This has the effect that I want except that it leaves the "release-build" parameter set to true after the build completes.
Does anyone have an idea on how to set the build parameter just for that one run of the build?
Thanks!
Peggy
Please sign in to leave a comment.
The question perhaps no longer relevant. If it's not please leave a comment or create a separate thread.
Kind regards,
Marina