Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign correct CASEDIR based on TEST_GIT_URL on clone function #278

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

b10n1k
Copy link
Contributor

@b10n1k b10n1k commented Jan 16, 2024

When TEST_GIT_URL is used the CASEDIR should assign the repo based on this variable. As such the investigation uses the correct test repo to clone jobs.

@b10n1k b10n1k requested a review from perlpunk January 16, 2024 10:59
Copy link
Contributor

@perlpunk perlpunk left a comment

Choose a reason for hiding this comment

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

See my comment

@perlpunk
Copy link
Contributor

Just adding the original patch I suggested to get you going for reference:

diff --git a/_common b/_common
index a86f421..a975f42 100644
--- a/_common
+++ b/_common
@@ -255,3 +255,7 @@ find_latest_published_tumbleweed_image() {
     echo "$image"
 }
 
+fetch-vars-json() {
+    local tid=$1
+    runcurl "${curl_args[@]}" -sS "$host_url/tests/$tid"/file/vars.json || return $?
+}
diff --git a/openqa-investigate b/openqa-investigate
index b7d4f16..93b9c3a 100755
--- a/openqa-investigate
+++ b/openqa-investigate
@@ -53,6 +53,8 @@ clone() {
     if [[ $refspec ]]; then
         casedir=$(echo "$clone_job_data" | runjq -r '.job.settings.CASEDIR') || return $?
         [[ $casedir == null ]] && casedir=''
+        vars=$(fetch-vars-json "$origin") || return $?
+        git_url=$(echo "$vars" | runjq -r '.TEST_GIT_URL') || return $?
         repo=${casedir:-'https://github.com/os-autoinst/os-autoinst-distri-opensuse.git'}
         clone_settings+=("CASEDIR=${repo%#*}#${refspec}")
     fi
diff --git a/test/02-investigate.t b/test/02-investigate.t
index b203e2f..115e45d 100644
--- a/test/02-investigate.t
+++ b/test/02-investigate.t
@@ -128,6 +128,11 @@ openqa-cli() {
     fi
 }
 
+fetch-vars-json() {
+    local tid=$1
+    echo '{"TEST_GIT_URL": "..."}'
+}
+
 clone_call=echo
 _clone_call() {
     echo "$@" >&2
@@ -139,6 +144,12 @@ testlabel="vim:investigate"
 has "$got" "* *$testlabel*: " "Expected markdown output of job urls for unsupported clusters"
 has "$got" '_TRIGGER_JOB_DONE_HOOK=1' "job is cloned with _TRIGGER_JOB_DONE_HOOK"
 
+try clone 10023 10024 foo refspec 2>&1
+is "$rc" 0 "Successful clone"
+testlabel="vim:investigate:foo"
+diag "!!!!!!!!!!!!!! $got"
+has "$got" '...'
+
 clone_call=echo
 try investigate 10027
 is "$rc" 0 'success regardless of actually triggered jobs'

I did have a reason to suggest creating a new function fetch-vars-json() ;-)

@b10n1k b10n1k force-pushed the fix_openqa_investigate branch 2 times, most recently from a53c00e to 2d2ba38 Compare January 17, 2024 13:06
@b10n1k b10n1k requested review from perlpunk and okurz January 17, 2024 19:31
@b10n1k b10n1k force-pushed the fix_openqa_investigate branch from 2d2ba38 to 673a998 Compare January 17, 2024 19:38
When TEST_GIT_URL is used the CASEDIR should assign the repo based on this
variable. As such the investigation uses the correct test repo to clone
jobs.

Signed-off-by: ybonatakis <[email protected]>
@b10n1k b10n1k force-pushed the fix_openqa_investigate branch from 673a998 to 72df157 Compare January 18, 2024 07:02
@b10n1k b10n1k requested a review from perlpunk January 18, 2024 07:05
@mergify mergify bot merged commit b0326a4 into os-autoinst:master Jan 18, 2024
4 checks passed
@perlpunk
Copy link
Contributor

btw, this was about https://progress.opensuse.org/issues/152681
The issue should ideally be mentioned in the commit message and PR description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants