hydra/src/root/jobset.tt

225 lines
7.1 KiB
Plaintext
Raw Normal View History

2013-02-21 01:33:57 +00:00
[% WRAPPER layout.tt title="Jobset $project.name:$jobset.name" %]
[% PROCESS common.tt %]
[% USE format %]
2013-03-19 15:14:47 +00:00
[% BLOCK renderJobsetInput %]
<tr class="input [% extraClass %]" [% IF id %]id="[% id %]"[% END %]>
<td>
2013-02-21 01:33:57 +00:00
<tt>[% HTML.escape(input.name) %]</tt>
</td>
<td>
[% INCLUDE renderSelection curValue=input.type param="$baseName-type" options=inputTypes %]
</td>
<td class="inputalts" id="[% baseName %]">
[% FOREACH alt IN input.search_related('jobsetinputalts', {}, { order_by => 'altnr' }) %]
<tt class="inputalt">
2013-02-21 01:33:57 +00:00
[% IF input.type == "string" %]
2014-08-13 15:25:08 +00:00
"<span class="keep-whitespace">[% HTML.escape(alt.value) %]</span>"
[% ELSE %]
2013-02-21 01:33:57 +00:00
[% HTML.escape(alt.value) %]
[% END %]
</tt>
[% END %]
</td>
</tr>
[% END %]
2013-03-19 15:14:47 +00:00
[% BLOCK renderJobsetInputs %]
2013-02-21 01:33:57 +00:00
<h3>Inputs</h3>
<table class="table table-striped table-condensed">
2013-02-21 01:33:57 +00:00
<thead>
<tr><th>Input name</th><th>Type</th><th>Values</th></tr>
</thead>
<tbody class="inputs">
[% FOREACH input IN jobset.jobsetinputs %]
2013-03-19 15:14:47 +00:00
[% INCLUDE renderJobsetInput input=input baseName="input-$input.name" %]
2013-02-21 01:33:57 +00:00
[% END %]
</tbody>
</table>
[% END %]
2013-02-21 01:33:57 +00:00
<ul class="nav nav-tabs">
2013-10-02 23:17:52 +00:00
[% IF c.user_exists %]
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
Actions
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
Enable declarative projects. This allows fully declarative project specifications. This is best illustrated by example: * I create a new project, setting the declarative spec file to "spec.json" and the declarative input to a git repo pointing at git://github.com/shlevy/declarative-hydra-example.git * hydra creates a special ".jobsets" jobset alongside the project * Just before evaluating the ".jobsets" jobset, hydra fetches declarative-hydra-example.git, reads spec.json as a jobset spec, and updates the jobset's configuration accordingly: { "enabled": 1, "hidden": false, "description": "Jobsets", "nixexprinput": "src", "nixexprpath": "default.nix", "checkinterval": 300, "schedulingshares": 100, "enableemail": false, "emailoverride": "", "keepnr": 3, "inputs": { "src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false }, "nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false } } } * When the "jobsets" job of the ".jobsets" jobset completes, hydra reads its output as a JSON representation of a dictionary of jobset specs and creates a jobset named "master" configured accordingly (In this example, this is the same configuration as .jobsets itself, except using release.nix instead of default.nix): { "enabled": 1, "hidden": false, "description": "js", "nixexprinput": "src", "nixexprpath": "release.nix", "checkinterval": 300, "schedulingshares": 100, "enableemail": false, "emailoverride": "", "keepnr": 3, "inputs": { "src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false }, "nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false } } }
2016-03-11 23:14:58 +00:00
[% UNLESS project.declfile %]
2013-10-14 15:43:31 +00:00
[% INCLUDE menuItem title="Edit configuration" icon="icon-edit" uri=c.uri_for(c.controller('Jobset').action_for('edit'), c.req.captures) %]
<!--
[% INCLUDE menuItem title="Delete this jobset" icon="icon-trash" uri="javascript:deleteJobset()" %]
-->
[% INCLUDE menuItem title="Clone this jobset" uri=c.uri_for(c.controller('Jobset').action_for('edit'), c.req.captures, { cloneJobset => 1 }) %]
Enable declarative projects. This allows fully declarative project specifications. This is best illustrated by example: * I create a new project, setting the declarative spec file to "spec.json" and the declarative input to a git repo pointing at git://github.com/shlevy/declarative-hydra-example.git * hydra creates a special ".jobsets" jobset alongside the project * Just before evaluating the ".jobsets" jobset, hydra fetches declarative-hydra-example.git, reads spec.json as a jobset spec, and updates the jobset's configuration accordingly: { "enabled": 1, "hidden": false, "description": "Jobsets", "nixexprinput": "src", "nixexprpath": "default.nix", "checkinterval": 300, "schedulingshares": 100, "enableemail": false, "emailoverride": "", "keepnr": 3, "inputs": { "src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false }, "nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false } } } * When the "jobsets" job of the ".jobsets" jobset completes, hydra reads its output as a JSON representation of a dictionary of jobset specs and creates a jobset named "master" configured accordingly (In this example, this is the same configuration as .jobsets itself, except using release.nix instead of default.nix): { "enabled": 1, "hidden": false, "description": "js", "nixexprinput": "src", "nixexprpath": "release.nix", "checkinterval": 300, "schedulingshares": 100, "enableemail": false, "emailoverride": "", "keepnr": 3, "inputs": { "src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false }, "nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false } } }
2016-03-11 23:14:58 +00:00
[% END %]
[% INCLUDE menuItem title="Evaluate this jobset" uri="javascript:confirmEvaluateJobset()" %]
2013-10-02 23:17:52 +00:00
</ul>
</li>
[% END %]
<li class="active"><a href="#tabs-evaluations" data-toggle="tab">Evaluations</a></li>
[% IF jobset.errormsg || jobset.fetcherrormsg %]
<li><a href="#tabs-errors" data-toggle="tab"><span class="text-warning">Evaluation errors</span></a></li>
2013-02-21 01:33:57 +00:00
[% END %]
<li><a href="#tabs-jobs" data-toggle="tab">Jobs</a></li>
<li><a href="#tabs-configuration" data-toggle="tab">Configuration</a></li>
<li><a href="#tabs-links" data-toggle="tab">Links</a></li>
<li><a href="#tabs-channels" data-toggle="tab">Channels</a></li>
2013-02-21 01:33:57 +00:00
</ul>
2013-01-22 13:41:02 +00:00
<div id="generic-tabs" class="tab-content">
2013-01-22 13:41:02 +00:00
<div id="tabs-evaluations" class="tab-pane active">
2013-02-21 12:42:44 +00:00
<table class="info-table">
<tr>
<th>Last checked:</th>
<td>
[% IF jobset.lastcheckedtime %]
[% INCLUDE renderDateTime timestamp = jobset.lastcheckedtime %], [% IF jobset.errormsg || jobset.fetcherrormsg %]<em class="text-warning">with errors!</em>[% ELSE %]<em>no errors</em>[% END %]
2013-02-22 10:37:35 +00:00
[% ELSE %]
<em>never</em>
[% END %]
</td>
</tr>
<tr>
<th>Last evaluation:</th>
<td>
[% IF latestEval %]
[% INCLUDE renderDateTime timestamp = latestEval.timestamp %]
[% ELSE %]
<em>never</em>
[% END %]
</td>
</tr>
[% IF jobset.starttime %]
<tr>
<th>Evaluation running since:</th>
<td>[% INCLUDE renderRelativeDate timestamp = jobset.starttime %]</td>
</tr>
[% ELSIF jobset.triggertime %]
<tr>
<th>Evaluation pending since:</th>
<td>[% INCLUDE renderRelativeDate timestamp = jobset.triggertime %]</td>
</tr>
[% END %]
</table>
<br/>
2013-02-21 01:33:57 +00:00
[% IF evals.size() > 0 %]
[% INCLUDE renderEvals linkToAll=c.uri_for(c.controller('Jobset').action_for('evals'), [project.name, jobset.name]) %]
[% END %]
</div>
[% IF jobset.errormsg || jobset.fetcherrormsg %]
2013-02-21 01:33:57 +00:00
<div id="tabs-errors" class="tab-pane">
2013-02-22 10:37:35 +00:00
<p>Errors occurred at [% INCLUDE renderDateTime timestamp=jobset.errortime %].</p>
<pre class="alert alert-error">[% HTML.escape(jobset.fetcherrormsg || jobset.errormsg) %]</pre>
2013-02-21 01:33:57 +00:00
</div>
[% END %]
<div id="tabs-configuration" class="tab-pane">
2013-02-21 01:33:57 +00:00
2013-02-21 12:42:44 +00:00
<table class="info-table">
<tr>
<th>State:</th>
<td>[% IF jobset.enabled == 0; "Disabled"; ELSIF jobset.enabled == 1; "Enabled"; ELSIF jobset.enabled == 2; "One-shot"; ELSIF jobset.enabled == 3; "One-at-a-time"; END %]</td>
</tr>
2013-02-21 01:33:57 +00:00
<tr>
<th>Description:</th>
<td>[% HTML.escape(jobset.description) %]</td>
</tr>
[% IF jobset.type == 1 %]
<tr>
<th>Flake URI:</th>
<td>
<tt>[% HTML.escape(jobset.flake) %]</tt>
</td>
</tr>
[% END %]
[% IF jobset.type == 0 %]
2013-02-21 01:33:57 +00:00
<tr>
<th>Nix expression:</th>
<td>
<tt>[% HTML.escape(jobset.nixexprpath) %]</tt> in input
<tt>[% HTML.escape(jobset.nixexprinput) %]</tt>
</td>
</tr>
[% END %]
<tr>
<th>Check interval:</th>
<td>[% jobset.checkinterval || "<em>disabled</em>" %]</td>
</tr>
<tr>
<th>Scheduling shares:</th>
<td>[% jobset.schedulingshares %] [% IF totalShares %] ([% f = format("%.2f"); f(jobset.schedulingshares / totalShares * 100) %]% out of [% totalShares %] shares)[% END %]</td>
</tr>
[% IF emailNotification %]
2013-02-21 01:33:57 +00:00
<tr>
<th>Enable email notification:</th>
<td>[% jobset.enableemail ? "Yes" : "No" %]</td>
</tr>
<tr>
<th>Email override:</th>
<td>[% HTML.escape(jobset.emailoverride) %]</td>
</tr>
[% END %]
2013-02-21 01:33:57 +00:00
<tr>
<th>Number of evaluations to keep:</th>
2013-02-21 01:33:57 +00:00
<td>[% jobset.keepnr %]</td>
</tr>
</table>
[% IF jobset.type == 0 %]
2013-03-19 15:14:47 +00:00
[% INCLUDE renderJobsetInputs %]
[% END %]
2013-02-21 01:33:57 +00:00
</div>
[% INCLUDE makeLazyTab tabName="tabs-jobs" uri=c.uri_for('/jobset' project.name jobset.name "jobs-tab") %]
<div id="tabs-links" class="tab-pane">
<ul>
<li><a href="[% c.uri_for(c.controller('Jobset').action_for('latest_eval'), c.req.captures) %]">Latest finished evaluation</a></li>
</ul>
</div>
[% INCLUDE makeLazyTab tabName="tabs-channels" uri=c.uri_for('/jobset' project.name jobset.name "channels-tab") %]
2013-02-21 01:33:57 +00:00
</div>
2013-10-02 23:17:52 +00:00
<script>
function confirmEvaluateJobset() {
bootbox.confirm(
'Are you sure you want to force evaluation of this jobset?',
function(c) {
if (!c) return;
requestJSON({
url: "[% HTML.escape(c.uri_for('/api/push', { jobsets = project.name _ ':' _ jobset.name, force = "1" })) %]",
success: function(data) {
bootbox.alert("The jobset has been scheduled for evaluation.");
}
});
});
};
function deleteJobset() {
bootbox.confirm(
'Are you sure you want to delete this jobset?',
function(c) {
if (!c) return;
redirectJSON({
2013-10-14 15:43:31 +00:00
url: "[% c.uri_for(c.controller('Jobset').action_for('jobset'), c.req.captures) %]",
type: 'DELETE'
});
2013-10-02 23:17:52 +00:00
});
};
</script>
[% END %]