Skip to content

Commit

Permalink
Add special icon for the always rollback flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodion Iafarov committed Oct 1, 2018
1 parent 35b151e commit 3ec364b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions lib/OpenQA/Schema/Result/JobModules.pm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ __PACKAGE__->add_columns(
is_nullable => 0,
default_value => 0
},
always_rollback => {
data_type => 'integer',
is_nullable => 0,
default_value => 0
},
result => {
data_type => 'varchar',
default_value => OpenQA::Jobs::Constants::NONE,
Expand Down
13 changes: 7 additions & 6 deletions lib/OpenQA/Schema/Result/Jobs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,12 @@ sub prepare_for_work {
$job_hashref->{settings}->{JOBTOKEN} = $token;

my $updated_settings = $self->register_assets_from_settings();
my @k = keys %$updated_settings; #better don't rely on random key hashes - even if we don't touch the hash meanwhile
my @k = keys %$updated_settings; #better don't rely on random key hashes - even if we don't touch the hash meanwhile

@{$job_hashref->{settings}}{@k} = @{$updated_settings}{@k}
if ($updated_settings);

if ( $job_hashref->{settings}->{NICTYPE}
if ($job_hashref->{settings}->{NICTYPE}
&& !defined $job_hashref->{settings}->{NICVLAN}
&& $job_hashref->{settings}->{NICTYPE} ne 'user')
{
Expand Down Expand Up @@ -852,7 +852,7 @@ sub auto_duplicate {
my $rsource = $self->result_source;
my $jobs = $rsource->schema->resultset("Jobs")->search(
{
id => {'!=' => $self->id, '-in' => [keys %$clones]},
id => {'!=' => $self->id, '-in' => [keys %$clones]},
state => [PRE_EXECUTION_STATES, EXECUTION_STATES],
});

Expand Down Expand Up @@ -1032,9 +1032,10 @@ sub insert_module {
{
# we have 'important' in the db but 'ignore_failure' in the flags
# for historical reasons...see #1266
milestone => $tm->{flags}->{milestone} ? 1 : 0,
important => $tm->{flags}->{ignore_failure} ? 0 : 1,
fatal => $tm->{flags}->{fatal} ? 1 : 0,
milestone => $tm->{flags}->{milestone} ? 1 : 0,
important => $tm->{flags}->{ignore_failure} ? 0 : 1,
fatal => $tm->{flags}->{fatal} ? 1 : 0,
always_rollback => $tm->{flags}->{always_rollback} ? 1 : 0,
});
return $r;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenQA/WebAPI/Controller/API/V1/Job.pm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ sub list {
category => $module->category,
result => $module->result,
flags => []};
for my $flag (qw(important fatal milestone)) {
for my $flag (qw(important fatal milestone always_rollback)) {
if ($module->get_column($flag)) {
push(@{$modulehash->{flags}}, $flag);
}
Expand Down
3 changes: 3 additions & 0 deletions templates/test/module_table.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
% if ($module->{milestone}) {
<i class="flag fa fa-anchor" title="Milestone: snapshot the state after this test for restoring"></i>
% }
% if ($module->{always_rollback}) {
<i class="flag fa fa-redo" title="Always rollback: revert to the last milestone snapshot even if test module is successful"></i>
% }
</div>
</td>
<td class="result <%= css_for($module) %>">
Expand Down

0 comments on commit 3ec364b

Please sign in to comment.