Change workspace build property programatically
Hi guys,
I was wondering to know if possible to change the build definition workspace programatically. As everything in my build definition for zOS is identical except an environment variable, target environment and the workspace to use.
I would like to execute (by RTC API) the build definitions from buildforge just by changing the workspace to use and one environment variable.
Is that possible?
I'm trying
buildDefinitionObj1.setConfigurationProperty("com.ibm.team.build.jazzscm","team.scm.WorkspaceUUID","_-cPrEJg1EeCIwcUNsKUI8Q");
but not sure if is going to work.
Thanks
I was wondering to know if possible to change the build definition workspace programatically. As everything in my build definition for zOS is identical except an environment variable, target environment and the workspace to use.
I would like to execute (by RTC API) the build definitions from buildforge just by changing the workspace to use and one environment variable.
Is that possible?
I'm trying
buildDefinitionObj1.setConfigurationProperty("com.ibm.team.build.jazzscm","team.scm.WorkspaceUUID","_-cPrEJg1EeCIwcUNsKUI8Q");
but not sure if is going to work.
Thanks
4 answers
Hi guys,
I was wondering to know if possible to change the build definition workspace programatically. As everything in my build definition for zOS is identical except an environment variable, target environment and the workspace to use.
I would like to execute (by RTC API) the build definitions from buildforge just by changing the workspace to use and one environment variable.
Is that possible?
I'm trying
buildDefinitionObj1.setConfigurationProperty("com.ibm.team.build.jazzscm","team.scm.WorkspaceUUID","_-cPrEJg1EeCIwcUNsKUI8Q");
but not sure if is going to work.
Thanks
Hi,
This example code will change the workspace.
IProgressMonitor monitor = new NullProgressMonitor();
ITeamRepository teamRepository = login(repositoryURI, userId, password, monitor);
ITeamBuildClient buildClient = (ITeamBuildClient) teamRepository.getClientLibrary(ITeamBuildClient.class);
IBuildDefinition buildDefinition = buildClient.getBuildDefinition(buildDefinitionId, monitor);
IBuildDefinition workingDefinitionCopy = (IBuildDefinition) buildDefinition.getWorkingCopy();
workingDefinitionCopy.setProperty(IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, "_ZOldwI0VEeCBE-fD7bmXpg");
buildDefinition = buildClient.save(workingDefinitionCopy, new NullProgressMonitor());
Brent Ulbricht
RTC Build Lead
Hi guys,
I was wondering to know if possible to change the build definition workspace programatically. As everything in my build definition for zOS is identical except an environment variable, target environment and the workspace to use.
I would like to execute (by RTC API) the build definitions from buildforge just by changing the workspace to use and one environment variable.
Is that possible?
I'm trying
buildDefinitionObj1.setConfigurationProperty("com.ibm.team.build.jazzscm","team.scm.WorkspaceUUID","_-cPrEJg1EeCIwcUNsKUI8Q");
but not sure if is going to work.
Thanks
Hi,
This example code will change the workspace.
IProgressMonitor monitor = new NullProgressMonitor();
ITeamRepository teamRepository = login(repositoryURI, userId, password, monitor);
ITeamBuildClient buildClient = (ITeamBuildClient) teamRepository.getClientLibrary(ITeamBuildClient.class);
IBuildDefinition buildDefinition = buildClient.getBuildDefinition(buildDefinitionId, monitor);
IBuildDefinition workingDefinitionCopy = (IBuildDefinition) buildDefinition.getWorkingCopy();
workingDefinitionCopy.setProperty(IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, "_ZOldwI0VEeCBE-fD7bmXpg");
buildDefinition = buildClient.save(workingDefinitionCopy, new NullProgressMonitor());
Brent Ulbricht
RTC Build Lead
Ohhhh Brent,
That's perfect!!! I have either solved the issue by creating a build property by API called team.scm.WorkspaceUUID with value UUID of workspace I want before the build runs and it worked as well.
Thanks a lot for your quick and right reply Brent.
Hi Brent,
I was initially getting the build definition as shown below using ITeamBuildService:
ITeamBuildService buildService = getService(ITeamBuildService.class);
IBuildDefinition buildDef = buildService.getBuildDefinition(buildId);
String buildDefId = buildDef.getId();
How is this different from getting build definition from
I was initially getting the build definition as shown below using ITeamBuildService:
ITeamBuildService buildService = getService(ITeamBuildService.class);
IBuildDefinition buildDef = buildService.getBuildDefinition(buildId);
String buildDefId = buildDef.getId();
How is this different from getting build definition from
ITeamBuildClient as you have shown in your answer above?
What is the difference between a TeamBuildService and a TeamBuildClient?
Thanks,
Ananya