From 1ef18b22c26934c13902f8782068f8b74bdd525c Mon Sep 17 00:00:00 2001 From: Junghyun Kim Date: Fri, 21 Jul 2017 13:53:21 +0900 Subject: [PATCH] Generate publish event for failed/broken/unresolvable. PROBLEM: - If the first building package is failed/broken/unresolable, a publish is not generated. This is normal because no difference made in the repo. - However, we need to generate a publish event to update dashboard even for this case. SOLUTION: - SCHEDULER: unresolvable/broken is checked by scheduler. Make :need_publish if we found any unresolable/broken package. This ensures that a publish event will be generated even if the repo has not been changed. - REPO_SERVER: It checks build fail. Make :need_publish if we found any package was failed to build. This ensures that a publish event will be generated even if the repo has not been changed. Change-Id: I640e3eca1b07d7cb2066423a38346c2f8ad1f20b Signed-off-by: Junghyun Kim --- src/backend/BSSched/Checker.pm | 6 ++++++ src/backend/bs_repserver | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/backend/BSSched/Checker.pm b/src/backend/BSSched/Checker.pm index a5de2bf..75b223b 100644 --- a/src/backend/BSSched/Checker.pm +++ b/src/backend/BSSched/Checker.pm @@ -865,6 +865,12 @@ sub printstats { my $packstatus = $ctx->{'packstatus'}; for my $status (sort keys %{{map {$_ => 1} values %$packstatus}}) { print " $status: ".scalar(grep {$_ eq $status} values %$packstatus)."\n"; + if( $status eq 'unresolvable' || $status eq 'broken' ) { + print "Touch :need_publish due to $status\n"; + my $reporoot = $ctx->{'gctx'}->{'reporoot'}; + my $projid = $ctx->{'project'}; + BSUtil::touch("$reporoot/$projid/:need_publish"); + } } print " looked harder: $ctx->{'nharder'}\n" if $ctx->{'nharder'}; my $building = $ctx->{'building'}; diff --git a/src/backend/bs_repserver b/src/backend/bs_repserver index ed8ee0e..73bccdf 100755 --- a/src/backend/bs_repserver +++ b/src/backend/bs_repserver @@ -1952,6 +1952,11 @@ sub putjob { BSNotify::notify('BUILD_UNCHANGED', \%ninfo); } else { BSNotify::notify($jobstatus->{'result'} eq 'succeeded' ? 'BUILD_SUCCESS' : 'BUILD_FAIL', \%ninfo); + # add need_publish if build failed. + if( $jobstatus->{'result'} ne 'succeeded' ) { + print "touch :need_publish due to BUILD_FAIL of pakage $info->{package}!\n"; + BSUtil::touch("$reporoot/$projid/:need_publish"); + } } # calculate binary info to speed up scheduler -- 2.7.4