문제

I am working on a build controller ot assist in the management of builds and deployments. In this process, it is necessary for me to specify the changeset number for the build. In the Build Configuration, when doing this manually, it is identical to setting the "Get Version" parameter in Process | Advanced.

When I set this value in the UI, I can then modify it when I get the build definition. The modification which I make causes the build to work as expected.

When Get Version is left blank, and I repeat the test, loading the params via code, I always get the latest version, as though the changeset is not being specified.

Here is my code:

    foreach (IBuildDefinition def in BuildDefinitions.SelectedItems)
{
    var process = WorkflowHelpers.DeserializeProcessParameters(def.ProcessParameters);                     
    process.Add("GetVersion", "C1111");
    // process["GetVersion"] = "C1133";
    def.ProcessParameters = WorkflowHelpers.SerializeProcessParameters(process);
    IQueuedBuild result = buildServer.QueueBuild(def);
}

It appears that the build definition may contain a different value between the two cases, but I am unable to locate it.

What am I missing?

도움이 되었습니까?

해결책

The this instead:

var request = def.CreateBuildRequest();
request.GetOption = GetOption.Custom;
request.CustomGetVersion = "C1234";
server.QueueBuild(request);

The documentation for IBuildServer.QueueBuild(IBuildDefinition) says:

Queues a build for the specified build definition with all default options.

I am guessing that it is not using most of the parameters from the definition passed in.

Actually, thinking about it, setting the params on the request makes sense, this is your build request, you're not changing the definition.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top