mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-11-24 23:03:08 +00:00
62 lines
1.5 KiB
Perl
Executable File
62 lines
1.5 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
use warnings;
|
|
use strict;
|
|
use REST::Client;
|
|
use JSON::XS;
|
|
use Data::Dumper;
|
|
|
|
my ($variant, $architecture) = @ARGV;
|
|
|
|
# When no architecture is given, fall back to x86_64.
|
|
unless ($architecture) {
|
|
$architecture = "x86_64";
|
|
}
|
|
|
|
my $netinst = "";
|
|
$variant = ucfirst($variant);
|
|
|
|
# If $variant is Netinst, then we will correct
|
|
# it to Server to get the correct links and then
|
|
# use the $netinst later to specify.
|
|
if ($variant eq "Netinst") {
|
|
$variant = "Server";
|
|
$netinst = "Netinst";
|
|
}
|
|
elsif ($variant eq "Kde") {
|
|
$variant = "KDE";
|
|
}
|
|
|
|
print("I am starting the tests for $variant $netinst.\n");
|
|
print("Trying to download the iso links.\n");
|
|
|
|
# Download the JSON file.
|
|
my $client = REST::Client->new();
|
|
$client->GET('https://openqa.fedoraproject.org/nightlies.json') or die("The iso links could not be downloaded. Exiting.");
|
|
|
|
print("Iso links downloaded correctly.\n");
|
|
|
|
my $json = decode_json($client->responseContent());
|
|
my $links = [];
|
|
|
|
# Push the link to $links when a match is found.
|
|
for my $iso (@$json) {
|
|
if (($iso->{arch} eq $architecture) and (lc($iso->{subvariant}) eq lc($variant))) {
|
|
push(@$links, "$iso->{url}");
|
|
}
|
|
}
|
|
|
|
my $isolink = $links->[-1];
|
|
#if ($netinst eq "Netinst") {
|
|
# $isolink = $links->[-1];
|
|
#}
|
|
|
|
print("Sending the API command to openQA: \n");
|
|
|
|
my $command = "openqa-cli api -X POST isos DISTRI=fedora VERSION=Rawhide FLAVOR=PiKVM ARCH=$architecture BUILD=Bare_install_$variant DOWNLOAD=$isolink SUBVARIANT=$variant";
|
|
|
|
print(" $command\n");
|
|
|
|
|
|
exec($command);
|