Commit 9ff9fe77 authored by Daniel Smith's avatar Daniel Smith

Add support for adding environment variables from scheduler page

parent 345d7780
......@@ -71,6 +71,7 @@ def parseArgs():
parser.add_argument("--SecondBuildOnHead", dest = "secondBuildOnHead", action="store_true", help="Enable this parameter to build the second commit against branch HEAD instead of searching for a COIN integration.")
parser.add_argument("--OpenGLBackend", dest = "openGLBackend", type=str, default="desktop", help="Render backend options. Valid options are \'dekstop\', \'angle\', \'software\'")
parser.add_argument("--jobName", dest = "jobName", type=str, help="unique job name used for writing results file to logs directory. Typically a hash of the job to be run.")
parser.add_argument("--environment", dest = "environment", type=str, help="Comma separated list of environment variables and values to use for the build and test environment.")
return parser.parse_args()
......@@ -221,6 +222,14 @@ def setWindowsEnv():
def prepareEnv():
# A place to do OS specific actions on startup.
if args.environment:
print(args.environment)
for variable in args.environment.split(','):
varName, varValue = variable.split('=')
os.environ[varName] = varValue
print(os.environ)
if isWindowsOS:
# set up windows build env
print('Setting up windows build environment.')
......
......@@ -372,7 +372,16 @@ function runTest(test) {
if (test.openGLBackend && test.platform == 'win32'){
args.push('--OpenGLBackend', test.openGLBackend); // Set the OpenGL backend override if selected in the web interface and this system is Windows.
}
if (test.environment){
if(Array.isArray(test.environment)){
args.push('--environment', test.environment.join(','));
}else{
args.push('--environment', test.environment);
}
}
var pythonexe = os.platform() == 'win32' ? 'python' : 'python3'; //Python3 for windows will simply be 'python'.
console.log('Launching ' + pythonexe + ' ' + args.join(' '));
test.status = 'running';
......@@ -546,6 +555,7 @@ function scheduleJobRequest(req, res){
expected_regression: req.body.expected_regression,
test_all: req.body.test_all,
test_hosts: Array.isArray(req.body.test_hosts) ? [req.body.test_hosts[i]] : [req.body.test_hosts],
environment: req.body.environment,
remote_job: req.body.remote_job,
master_host: req.body.master_host
};
......@@ -660,6 +670,7 @@ function queryJobs(req, res){
expected_regression: runningJob.expected_regression,
test_all: runningJob.test_all,
test_hosts: runningJob.test_hosts,
environment: runningJob.environment,
remote_job: runningJob.remote_job,
master_host: runningJob.master_host
};
......@@ -966,6 +977,20 @@ function schedulerPage(req, res) {
<label for="test_hosts">Run job on host:</label><br>
${hostSelectionComboBox}
<hr style="width:20%">
<label for="environment">Set custom environment variables on hosts:</label><br>
<table>
<th>Variables</th><th>Variable name</th><th>Variable Value</th>
<tr valign="top" height=0%>
<td rowspan=2>
<select id="environment" name="environment" size=2 style="min-width:100px;overflow:hidden" multiple></select>
</td>
<td><input id="environmentName" name="environmentName" type="text" style="width:200"></input></td>
<td><input id="environmentValue" name="environmentValue" type="text" style="width:200"></input></td>
</tr>
<tr valign="top">
<td align="center" colspan=2 style="padding-top:5px"><button type="button" onclick="AddEnvironmentVariable()">Add Environment Variable</button></td>
</table>
<hr style="width:20%">
<label for="owner">Enter email to receive notices about this job: </label><br>
<input id="owner" type="email" style="width:400;" name="owner" placeholder="someone@qt.io"><br>
<br>
......@@ -1006,6 +1031,20 @@ function schedulerPage(req, res) {
<label for="test_hosts">Run job on host:</label><br>
${hostSelectionComboBox}
<hr style="width:20%">
<label for="environment">Set custom environment variables on hosts:</label><br>
<table>
<th>Variables</th><th>Variable name</th><th>Variable Value</th>
<tr valign="top" height=0%>
<td rowspan=2>
<select id="environment" name="environment" size=2 style="min-width:100px;overflow:hidden" multiple></select>
</td>
<td><input id="environmentName" name="environmentName" type="text" style="width:200"></input></td>
<td><input id="environmentValue" name="environmentValue" type="text" style="width:200"></input></td>
</tr>
<tr valign="top">
<td align="center" colspan=2 style="padding-top:5px"><button type="button" onclick="AddEnvironmentVariable()">Add Environment Variable</button></td>
</table>
<hr style="width:20%">
<label for="owner">Enter email to receive notices about this job: </label><br>
<input id="owner" type="email" style="width:400;" name="owner" placeholder="someone@qt.io"><br>
<br>
......@@ -1050,6 +1089,20 @@ function schedulerPage(req, res) {
<label for="test_hosts">Run job on host:</label><br>
${hostSelectionComboBox}
<hr style="width:20%">
<label for="environment">Set custom environment variables on hosts:</label><br>
<table>
<th>Variables</th><th>Variable name</th><th>Variable Value</th>
<tr valign="top" height=0%>
<td rowspan=2>
<select id="environment" name="environment" size=2 style="min-width:100px;overflow:hidden" multiple></select>
</td>
<td><input id="environmentName" name="environmentName" type="text" style="width:200"></input></td>
<td><input id="environmentValue" name="environmentValue" type="text" style="width:200"></input></td>
</tr>
<tr valign="top">
<td align="center" colspan=2 style="padding-top:5px"><button type="button" onclick="AddEnvironmentVariable()">Add Environment Variable</button></td>
</table>
<hr style="width:20%">
<label for="owner">Enter email to receive notices about this job: </label><br>
<input id="owner" type="email" style="width:400;" name="owner" placeholder="someone@qt.io"><br>
<br>
......@@ -1152,6 +1205,7 @@ function schedulerPage(req, res) {
Utils.findChildById(activeElement, "submit", true).disabled = false;
}
}
function disableSecondCommit(){
var e = Utils.findChildById(activeElement, "simpleRegressionTest", true)
if (e.checked){
......@@ -1170,6 +1224,21 @@ function schedulerPage(req, res) {
console.log("Finished")
}
function AddEnvironmentVariable(){
var e = Utils.findChildById(activeElement, "environment", true)
var n = Utils.findChildById(activeElement, "environmentName", true)
var v = Utils.findChildById(activeElement, "environmentValue", true)
if(n.value != "" && v.value != "") {
var option = document.createElement("option");
option.text = \`\${n.value}=\${v.value}\`;
option.selected = true;
e.add(option);
e.size = e.length
n.value = ""
v.value = ""
}
}
</script>
<script src="awesomeplete/awesomplete.js" async>
// var input = document.getElementById("test_name");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment