Project

General

Profile

Actions

action #130096

closed

openqa-clone-custom-git-refspec modifies PRODUCTDIR setting

Added by rainerkoenig over 1 year ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Feature requests
Target version:
Start date:
2023-05-30
Due date:
% Done:

0%

Estimated time:

Description

Observation

Tried to run a VR with the following command

$ openqa-clone-custom-git-refspec https://github.com/rakoenig/os-autoinst-distri-opensuse/tree/yast_cc_container https://openqa.opensuse.org/tests/3313986

This leds to a failure in the cloned job:

[2023-05-30T11:15:42.330782+02:00] [warn] [pid:32320] !!! main: PRODUCTDIR 'os-autoinst-distri-opensuseproducts/alp' invalid, could not be found at /usr/lib/os-autoinst/OpenQA/Isotovideo/Utils.pm line 269.

So I modified the script to ouput the cmd issued at the end and see what happens to PRODUCTDIR on varius clone (dry runs):

test url old_product_dir productdir
https://openqa.opensuse.org/tests/3313986 "products/alp" "os-autoinst-distri-opensuseproducts/alp"
https://openqa.opensuse.org/tests/3323239 "opensuse/products/opensuse" "os-autoinst-distri-opensuse/products/opensuse"
https://openqa.suse.de/tests/11215764 "sle/products/sle" os-autoinst-distri-opensuse/products/sle"

So in the first attempt we run into that error because we're missing a / after os-autoinst-distri-opensuse. Nevertheless: The resulting productdir setting is never the same as it is stored in the vars.json of the original job.

Additinal info

The lines to be investigated start here:

        local old_productdir
        old_productdir=$(echo "$json_data" | jq -r '.PRODUCTDIR') || throw_json_error "$json_url" "$json_data"
        local old_casedir
        old_casedir=$(echo "$json_data" | jq -r '.CASEDIR') || throw_json_error "$json_url" "$json_data"
        if [[ ${old_productdir:0:1} == "/" ]]; then
            local productdir="${productdir:-"${repo_name##*/}${old_productdir##"$old_casedir"}"}"
        else
            local productdir="${productdir:-"${repo_name##*/}${old_productdir#*"${old_casedir##*/}"}"}"
        fi

The documentation for PRODUCTDIR says:

Absolute or relative path to the optional "product directory" which includes the test schedule entry point main.pm as well as a needles subdirectory with the needles to load. Defaults to CASEDIR. Relative paths are considered relative to CASEDIR.

So it looks like if [[ ${old_productdir:0:1} == "/" ]]; then tries to distinguish between absolute and relative paths. I just don't understand the use of it. We're cloning from an existing job that did this already and so from my understanding it would be enough just to copy the PRODUCTDIR from the original job.

Even a line like local productdir="${productdir:-"${repo_name##*/}${old_productdir#*"${old_casedir##*/}"}"}" does not seem to make sens because the initial check ${productdir:- will result in false, since we just declared productdir as a local setting and so it should be empty, isn't it?

Proposed action

Think about the argements above and fix it in a way that does not make cloned tests fail.

Actions

Also available in: Atom PDF