|
(→Change Environments of an Agent)
|
(Added in evaluate script step version of AHPSCRIPTS-109)
|
| Line 51: | |||
| uow.close();</pre> | uow.close();</pre> | ||
| + | ''A modified version that will work from an '''evaluate script''' step'' | ||
| + | <pre>import com.urbancode.anthill3.domain.buildlife.*; | ||
| + | import com.urbancode.codestation2.server.*; | ||
| + | //GRAB VALUE FROM WORKFLOW PROPERTY AND TURN IT INTO A LONG. | ||
| + | //targetbl IS A WORKFLOW PROPERTY WITH THE TARGET BUILDLIFE NUMBER. | ||
| + | String targetBuildLifeString = PropertyLookup.getValue("targetbl"); | ||
| + | Long targetBuildLife = Long.parseLong(targetBuildLifeString, 10); | ||
| + | //GET THE BUILDLIFE | ||
| + | BuildLife buildLife = BuildLifeFactory.getInstance().restore(targetBuildLife); | ||
| + | //GET CLASS TO LIST ARTIFACTS | ||
| + | CodestationRepositoryFileHelper cs = CodestationRepositoryFileHelper.getInstance(); | ||
| + | sets = cs.getPopulatedBuildLifeArtifactSetList(buildLife); | ||
| + | //PREPARE THE ah3server.out | ||
| + | //THE System.out LINES CAN BE REMOVED. THEY ARE FOR DEBUGGING PURPOSES ONLY! | ||
| + | System.out.println("\n\n\n"); | ||
| + | //LOOP THROUGH ARTIFACT SETS | ||
| + | for (int s=0; s<sets.length; s++) { | ||
| + | //WRITE OUT EACH ARTIFACT SET NAME | ||
| + | commandOutput.println(""); | ||
| + | System.out.println(""); | ||
| + | commandOutput.println("Contents of '" + sets[s].getName() + "'"); | ||
| + | System.out.println("Contents of '" + sets[s].getName() + "'"); | ||
| + | |||
| + | //GET ARTIFACTS | ||
| + | artifacts = cs.listBuildLifeArtifactSetFiles(buildLife, sets[s]); | ||
| + | |||
| + | for (int a=0; a<artifacts.length; a++) { | ||
| + | //PRINT EACH ARTIFACT | ||
| + | commandOutput.println(" " + artifacts[a]); | ||
| + | System.out.println(" " + artifacts[a]); | ||
| + | }//END ARTIFACTS FOR | ||
| + | }//END ARTIFACT SET FOR</pre> | ||
| = Update Environment Properties for All Projects = | = Update Environment Properties for All Projects = | ||
| The idea here is that you may have secure value that is the same for all projects that are in a particular environment. Especially for passwords which could change regularly, going into each project to enter this is lame. Here's a remote script to do it. | The idea here is that you may have secure value that is the same for all projects that are in a particular environment. Especially for passwords which could change regularly, going into each project to enter this is lame. Here's a remote script to do it. | ||