Skip to content

Commit

Permalink
Make jobs running without needing to set needles URL specifically
Browse files Browse the repository at this point in the history
As per https://progress.opensuse.org/issues/162632,
openqa-clone-custom-git-refspec might fail in case NEEDLES_DIR is set and
contains an absolute path which directs to the pool.
Also in contrast of the poo's suggestion there is no change in removal of the
vars.json logic.

Signed-off-by: ybonatakis <[email protected]>
  • Loading branch information
b10n1k committed Jul 30, 2024
1 parent ef1c555 commit 776bd58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions script/openqa-clone-custom-git-refspec
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ Please try 'curl $json_url' or select another job, e.g. in the same scenario: $h
local old_needledir
old_needledir=$(echo "$json_data" | jq -r '.NEEDLES_DIR | select (.!=null)') || throw_json_error "$json_url" "$json_data"
local needles_dir="${needles_dir:-"$old_needledir"}"
if [[ -n $needles_dir ]]; then
needles_dir=$(echo "$json_data" | jq -r '.NEEDLES_GIT_URL | select (.!=null)') || throw_json_error "$json_url" "$json_data"
fi
needles_dir="${needles_dir:-"$old_productdir/needles"}"
fi
local repo_branch="${repo_branch:-"$repo_name#$branch"}"
Expand Down
6 changes: 3 additions & 3 deletions t/40-script_openqa-clone-custom-git-refspec.t
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ $expected_re = qr/${expected}/s;
test_once $args, $expected_re, 'clone-job command with multiple URLs in PR and job URL';

$ENV{curl_github} = qq{echo -e '{"head": {"label": "user:my/branch"}, "body": "Lorem ipsum"}'; true};
my $needles = 'my/distri/products/sle/needles';
my $needles = 'products/sle/needles';
$ENV{curl_openqa}
= qq{echo -e '{"TEST": "my_test", "CASEDIR": "my/distri", "PRODUCTDIR": "distri/products/sle", "NEEDLES_DIR": "$needles"}'; true};
$dirs = "CASEDIR=https://github.com/user/repo.git#my/branch PRODUCTDIR=repo/products/sle NEEDLES_DIR=$needles";
$dirs = "CASEDIR=https://github.com/user/repo.git#my/branch PRODUCTDIR=repo/products/sle NEEDLES_DIR=distri/$needles";
$expected = $clone_job . '1169326 _GROUP=0 TEST\+=\@user/repo#my/branch BUILD=user/repo#9539 ';
$expected_re = qr/${expected}${dirs}/;
test_once $args, $expected_re, "PRODUCTDIR is correct when the source job's PRODUCTDIR is a relative directory";

$needles = "/$needles";
$needles = "$needles";
$ENV{curl_openqa}
= qq{echo -e '{"TEST": "my_test", "CASEDIR": "/my/distri", "PRODUCTDIR": "products/sle", "NEEDLES_DIR": "$needles"}'; true};
$dirs = "CASEDIR=https://github.com/user/repo.git#my/branch PRODUCTDIR=repo/products/sle NEEDLES_DIR=$needles";
Expand Down

0 comments on commit 776bd58

Please sign in to comment.