Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Trigger a Configuration Build from groovy script #2309

direla ·
Hello,

How can I run a build configuration in a script?

I'm reading a file and setting different variables in different configurations and I want to start the build configurations while iterating the file.

Thank you !!!

groovy:
import java.io.*;
import com.pmease.quickbuild.variable.*;
import com.pmease.quickbuild.*;

String WorkspacePath = configuration.getWorkspaceDir().getAbsolutePath();
String RepoPath = vars.get("GIT_REPONAME_COMPILATIONFILE").getValue();
String pathIni = WorkspacePath + "\" + RepoPath +"\Compilacions.txt ";
logger.info("-> $pathIni ");
File file = new File(pathIni);
BufferedReader br = new BufferedReader(new FileReader(file));

String str;
String [] campos;

logger.info("Iniciamos la/s compilacion/es: ");

while ( (str = br.readLine()) != null )
{
if (str == "" || str.charAt(0) == '#' )
continue;

campos = str.split();


String Maquina = campos[0];
String MaquinaBranch = campos[1];
String LibtotalBranch = campos[2];
String PGTBranch = campos[3];
String TCPBranch = campos[4];
String SDKBranch = campos[5];

logger.info("READ: $Maquina $MaquinaBranch $LibtotalBranch $PGTBranch $TCPBranch $SDKBranch");

def conf = system.getConfiguration("root/" + Maquina);
if (conf == null)
{
logger.info("No Existe esta version de maquina");
throw new QuickbuildException("No extste el nombre de la maquina: " + Maquina + " en quick build");
}

conf.getVar("GIT_BRANCH_MACHINE").setValue(MaquinaBranch);
conf.getVar("GIT_BRANCH_LIBTOTAL").setValue(LibtotalBranch);
conf.getVar("GIT_BRANCH_PGT").setValue(PGTBranch);
conf.getVar("GIT_BRANCH_TCP").setValue(TCPBranch);
conf.getVar("GIT_BRANCH_SDK").setValue(SDKBranch);
system.configurationManager.save(conf);

// ****************************************** HEREEEEEEEEEEEEEE ********************************************************
// I NEED TO RUN THE CURRENT BUILD CONFIGURATION AND WAIT TILL IT FINISHES TO CONTINUE ITERATING THE FILE
// HOW?
// ****************************************** HEREEEEEEEEEEEEEE ********************************************************

}
  • replies 1
  • views 1625
  • stars 0
robinshen ADMIN ·
Triggering configuration and waiting for its completeness is quite involved. Please consider using the "trigger other build" step and if you need to interate over multiple configurations, edit the advanced setting to execute the step repeatly each time with a different configuration. You may change the configuration variable in pre-execute action of the trigger build step.