Commit 997b42ee authored by Xavier Guimard's avatar Xavier Guimard

salsa: skip project in update_repo if hooks are not available

parent 8e4b03fd
......@@ -22,6 +22,7 @@ devscripts (2.18.12) UNRELEASED; urgency=medium
MR: !94
+ Add a --ci-config-path option. MR: !96
+ push_repo: allow to push even if the project already exists. MR: !97
+ Skip project in update_repo if hooks are not available.
* uscan:
+ Fix warning when grouped package is up to date.
* French translation update.
......
......@@ -16,6 +16,7 @@ sub add_hooks {
or $self->config->email
or $self->config->disable_email) {
my $hooks = $self->enabled_hooks($repo_id);
return 1 unless (defined $hooks);
# KGB hook (IRC)
if ($self->config->kgb or $self->config->disable_kgb) {
unless ($self->config->irc_channel->[0]
......@@ -147,7 +148,11 @@ sub enabled_hooks {
or $self->config->disable_kgb
or $self->config->tagpending
or $self->config->disable_tagpending) {
$hooks = $self->api->project_hooks($repo_id);
$hooks = eval { $self->api->project_hooks($repo_id) };
if ($@) {
ds_warn "Unable to check hooks for project $repo_id";
return undef;
}
foreach (@{$hooks}) {
$res->{kgb} = {
id => $_->{id},
......
......@@ -11,6 +11,7 @@ sub get_repo {
my ($self, $prompt, @reponames) = @_;
my @repos;
if ($self->config->all and @reponames == 0) {
ds_debug "--all is set";
my $projects;
# This rule disallow trying to configure all "Debian" projects:
# - Debian id is 2
......
......@@ -30,6 +30,7 @@ sub _check_repo {
return @repos unless (ref $repos[0]);
foreach my $repo (@repos) {
my ($id, $name) = @$repo;
ds_debug "Checking $name ($id)";
my @err;
my $project = eval { $self->api->project($id) };
unless ($project) {
......@@ -57,6 +58,10 @@ sub _check_repo {
}
# Webhooks (from Devscripts::Salsa::Hooks)
my $hooks = $self->enabled_hooks($id);
unless (defined $hooks) {
ds_warn "Unable to get $name hooks";
next;
}
# KGB
if ($self->config->kgb and not $hooks->{kgb}) {
push @err, "kgb missing";
......
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