Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions lib/OpenQA/Task/Git/Clone.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,26 @@ sub _git_clone_all ($job, $clones) {
die "Don't even think about putting '..' into '$path'." if $path =~ /\.\./;

my $git = OpenQA::Git->new(app => $app, dir => $path);
my $origin_url = -d $path ? $git->get_origin_url : undef;
my $url = $origin_url // $clones->{$path};
my $server_host = _extract_server_host($url);
my $url_cfg = $clones->{$path};
my $origin_url;
my $server_host = 'other';
my $error;
try {
_git_clone($git, $ctx, $path, $clones->{$path}, $origin_url);
my $is_repo = (-d $path) && (-d "$path/.git");
$origin_url = $is_repo ? $git->get_origin_url : undef;
my $url = $origin_url // $url_cfg;
$server_host = defined $url ? _extract_server_host($url) : 'other';

unless (defined $url || $is_repo) {
$ctx->info("Skipping '$path': no URL configured and not a git repo.");
next;
}

_git_clone($git, $ctx, $path, $url_cfg, $origin_url);
report_server_available($app, $server_host);
next;
}
catch ($e) { $error = $e }
catch ($e) { $error = "$e" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In perl, if applied to a regex, a variable is automatically stringified, so that should not be necessary

if ($error =~ /Internal API unreachable/) {
my $outcome = report_server_unavailable($app, $server_host);
if ($outcome eq 'SKIP') {
Expand Down