Skip to content

Commit dfb5af1

Browse files
authored
Merge pull request #6594 from perlpunk/refspec-short-urls
Support short test urls in openqa-clone-custom-git-refspec
2 parents 606fa3c + d6e8f26 commit dfb5af1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

script/openqa-clone-custom-git-refspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ clone_job() {
136136
local job_url="${1:?"Need 'job_url' parameter"}"
137137
local host=${job_url%%/t*}
138138
local job=${job_url##*/}
139+
job=${job##t}
139140
fi
140141
if [[ -z "$testsuite" ]] || [[ -z "$productdir" ]]; then
141142
local json_url=${host}/tests/${job}/file/vars.json

t/40-script_openqa-clone-custom-git-refspec.t

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ test_once "-v $args", qr/\+ local dry_run/, 'clone-job with -v prints commands';
4646
test_once "-n -v $args", qr/\+ local dry_run/, 'clone-job with -n -v prints commands';
4747
my $args_branch = 'https://github.com/user/repo/tree/my/branch https://openqa.opensuse.org/tests/1234 FOO=bar';
4848
my $expected_branch_re
49-
= qr{${clone_job}1234 _GROUP=0 TEST\+=\@user/repo#my/branch BUILD=user/repo#my/branch ${dirs} FOO=bar};
49+
= qr{${clone_job}1234 _GROUP=0 TEST\+=\@user/repo\#my/branch BUILD=user/repo\#my/branch ${dirs} FOO=bar};
5050
test_once $args_branch, $expected_branch_re, 'alternative mode with branch reference also yields right variables';
5151
my $prefix = 'env repo_name=user/repo pr=9128 host=https://openqa.opensuse.org job=1234';
5252
combined_like { $ret = run_once('', $prefix) } $expected_re, 'environment variables can be used instead';
@@ -57,7 +57,7 @@ my $expected_custom_re = qr{https://openqa.opensuse.org 1234 _GROUP=0 .*${dirs}}
5757
combined_like { $ret = run_once('', $prefix) } $expected_custom_re, 'testsuite and dirs can be overridden';
5858
is $ret, 0, 'exits successfully';
5959
my $args_trailing = 'https://github.com/me/repo/pull/1/ https://openqa.opensuse.org/tests/1';
60-
test_once $args_trailing, qr{TEST\+=\@user/repo#my/branch.*}, 'trailing slash ignored';
60+
test_once $args_trailing, qr{TEST\+=\@user/repo\#my/branch.*}, 'trailing slash ignored';
6161
my $args_list = $args . ',https://openqa.opensuse.org/tests/1234';
6262
$expected_re = qr/${expected}.*opensuse.org 1234/s;
6363
test_once $args_list, $expected_re, 'accepts comma-separated list of jobs';
@@ -75,13 +75,12 @@ $expected_re = qr/TEST1=BLUB\r?\nTEST2=\$VAR\r?\nTEST3=space space\r?\nTEST4=\(!
7575
combined_like { run_once($args_escape, q(dry_run='printf "%s\n"')) } $expected_re,
7676
'Custom variables has proper bash escaping';
7777

78-
TODO: {
79-
local $TODO = 'not implemented';
78+
subtest 'short urls' => sub {
8079
$args = 'https://github.com/user/repo/pull/9128 https://openqa.opensuse.org/t1234';
8180
test_once $args, qr/${expected}/, 'short test URLs are supported the same';
8281
$args .= ',https://openqa.suse.de/t1234';
8382
test_once $args, qr/${expected}.* 1234/s, 'multiple short URLs from different hosts point to individual hosts';
84-
}
83+
};
8584

8685
my $test_url = 'https://openqa.opensuse.org/tests/1107158';
8786
$ENV{curl_github} = qq{echo -e '{"head": {"label": "user:my_branch"}, "body": "\@openqa: Clone ${test_url}"}'; true};

0 commit comments

Comments
 (0)