Line 1359: |
|
print("Committing Changes"); |
|
print("Committing Changes"); |
|
uow.commitAndClose();</pre> |
|
uow.commitAndClose();</pre> |
|
|
|
|
|
|
+ |
= Return List of All Build Lives in Particular Environment =
|
|
|
|
|
|
|
+ |
*This script is intended to be used a remote script, which means in order to use it, you must download the remoting API package from the "Tools" link in the UI.
|
|
|
+ |
**Click on the Tools link the UI, and download the remoting package.
|
|
|
+ |
**Copy the attached script, save it in a file named "environment.bsh"
|
|
|
+ |
**Edit the script so that the serverHost, username, password match your login credentials.
|
|
|
+ |
**Edit the script so that it is searching for the correct environment name (the example uses "Build-Farm")
|
|
|
+ |
**From your command line, go to the /bin directory of the anthill3-remoting directory (created when you unzipped the download from step one)
|
|
|
+ |
**Run the following on linux:<font face=monospace> ./ah3client.sh environment.bsh </font> or if you are using windows:<font face=monospace> ah3client.cmd environment.bsh</font>
|
|
|
|
|
|
|
+ |
==== AHPSCRIPTS-100 ====
|
|
|
+ |
<pre>import com.urbancode.anthill3.domain.workflow.*;
|
|
|
+ |
import com.urbancode.anthill3.main.client.*;
|
|
|
+ |
import com.urbancode.anthill3.persistence.*;
|
|
|
+ |
import com.urbancode.anthill3.domain.servergroup.*;
|
|
|
|
|
|
|
|
|
|
|
+ |
String serverHost = "localhost";
|
|
|
+ |
int serverPort = 4567;
|
|
|
+ |
String userName = "admin";
|
|
|
+ |
String password = "admin";
|
|
|
|
|
|
|
+ |
// obtain connection to the Anthill server
|
|
|
+ |
AnthillClient anthill = AnthillClient.connect(serverHost, serverPort, userName, password);
|
|
|
|
|
|
|
+ |
// create a Unit of Work
|
|
|
+ |
UnitOfWork uow = anthill.createUnitOfWork();
|
|
|
|
|
|
|
+ |
WorkflowCase[] workflowCases = WorkflowCaseFactory.getInstance().restoreAll();
|
|
|
|
|
|
|
+ |
String EnvironmentName = "Build-Farm";
|
|
|
|
|
|
|
+ |
for (int x=0; x<workflowCases.length; x++) {
|
|
|
+ |
ServerGroup serverGroup = workflowCases[x].getServerGroup();
|
|
|
+ |
if (EnvironmentName.equals(serverGroup.getName())){
|
|
|
+ |
int ID = workflowCases[x].getBuildLife().getId();
|
|
|
+ |
System.out.println("BuildLife id = " + ID + " exists in " + EnvironmentName );
|
|
|
+ |
}//end if
|
|
|
+ |
}//end for
|
|
|
|
|
|
|
+ |
uow.close();</pre>
|