public void run()
{
state = State.RUNNING;
try {
// Initialize project dir
initProjectDir();
// Add build commands
foreach (string sCommand in buildInfo.GetCommands ())
{
commands.AddLast(sCommand);
}
// Execute
foreach (string sCommand in commands)
{
if (!exec(sCommand))
{
state = State.FAILED;
break;
}
}
if (state == State.RUNNING)
{
state = State.SUCCESS;
}
} catch (Exception rex) {
outputList.Enqueue("");
outputList.Enqueue("A runner exception occoured: " + rex.Message);
outputList.Enqueue("");
state = State.FAILED;
}
completed = true;
}
public void runTest() { // copied from official gitlab ci runner spec BuildInfo buildInfo = new BuildInfo(); buildInfo.commands = "dir"; buildInfo.allow_git_fetch = false; buildInfo.project_id = 0; buildInfo.id = 9312; buildInfo.repo_url = "https://github.com/randx/six.git"; buildInfo.sha = "2e008a711430a16092cd6a20c225807cb3f51db7"; buildInfo.timeout = 1800; buildInfo.@ref = "master"; gitlab_ci_runner.runner.Build target = new gitlab_ci_runner.runner.Build(buildInfo); target.run(); Console.WriteLine(target.output); Assert.AreEqual(target.state, State.SUCCESS); }