Module: Mesa
Branch: main
Commit: f7f2d26e3b29ff727c83a3fd27e973977449ad62
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f7f2d26e3b29ff727c83a3fd27e973977449ad62

Author: Guilherme Gallo <guilherme.ga...@collabora.com>
Date:   Wed Oct 25 11:30:44 2023 -0300

ci/lava: Use project_name instead of hardcoded `mesa`

The LAVA job submitter is being used by other fd.o projects, such as
`drm/ci`, so let's make it generate more generic job definitions and
test cases.

Signed-off-by: Guilherme Gallo <guilherme.ga...@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25912>

---

 .gitlab-ci/lava/lava-submit.sh               | 1 +
 .gitlab-ci/lava/lava_job_submitter.py        | 1 +
 .gitlab-ci/lava/utils/lava_job_definition.py | 2 +-
 .gitlab-ci/lava/utils/ssh_job_definition.py  | 2 +-
 .gitlab-ci/lava/utils/uart_job_definition.py | 2 +-
 5 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci/lava/lava-submit.sh b/.gitlab-ci/lava/lava-submit.sh
index e02bcb24cba..e8521d50518 100755
--- a/.gitlab-ci/lava/lava-submit.sh
+++ b/.gitlab-ci/lava/lava-submit.sh
@@ -58,4 +58,5 @@ PYTHONPATH=artifacts/ artifacts/lava/lava_job_submitter.py \
        --mesa-job-name "$CI_JOB_NAME" \
        --structured-log-file "results/lava_job_detail.json" \
        --ssh-client-image "${LAVA_SSH_CLIENT_IMAGE}" \
+       --project-name "${CI_PROJECT_NAME}" \
        >> results/lava.log
diff --git a/.gitlab-ci/lava/lava_job_submitter.py 
b/.gitlab-ci/lava/lava_job_submitter.py
index b2d8e5306e7..c6774a0b695 100755
--- a/.gitlab-ci/lava/lava_job_submitter.py
+++ b/.gitlab-ci/lava/lava_job_submitter.py
@@ -379,6 +379,7 @@ class LAVAJobSubmitter(PathResolver):
     job_rootfs_overlay_url: str = None
     structured_log_file: pathlib.Path = None  # Log file path with structured 
LAVA log
     ssh_client_image: str = None  # x86_64 SSH client image to follow the 
job's output
+    project_name: str = None  # Project name to be used in the job name
     __structured_log_context = contextlib.nullcontext()  # Structured Logger 
context
 
     def __post_init__(self) -> None:
diff --git a/.gitlab-ci/lava/utils/lava_job_definition.py 
b/.gitlab-ci/lava/utils/lava_job_definition.py
index c7b43658cb5..198518bd7d2 100644
--- a/.gitlab-ci/lava/utils/lava_job_definition.py
+++ b/.gitlab-ci/lava/utils/lava_job_definition.py
@@ -81,7 +81,7 @@ def to_yaml_block(steps_array: list[str], escape_vars=[]) -> 
LiteralScalarString
 def generate_metadata(args) -> dict[str, Any]:
     # General metadata and permissions
     values = {
-        "job_name": f"mesa: {args.pipeline_info}",
+        "job_name": f"{args.project_name}: {args.pipeline_info}",
         "device_type": args.device_type,
         "visibility": {"group": [args.visibility_group]},
         "priority": JOB_PRIORITY,
diff --git a/.gitlab-ci/lava/utils/ssh_job_definition.py 
b/.gitlab-ci/lava/utils/ssh_job_definition.py
index 1308e5ca92a..0c2c4dbcebf 100644
--- a/.gitlab-ci/lava/utils/ssh_job_definition.py
+++ b/.gitlab-ci/lava/utils/ssh_job_definition.py
@@ -155,7 +155,7 @@ def generate_docker_test(args):
         "export SSH_PTY_ARGS=-tt",
         # Putting CI_JOB name as the testcase name, it may help LAVA farm
         # maintainers with monitoring
-        f"lava_ssh_test_case 'mesa-ci_{args.mesa_job_name}' "
+        f"lava_ssh_test_case '{args.project_name}_{args.mesa_job_name}' "
         # Changing directory to /, as the HWCI_SCRIPT expects that
         "'\"cd / && /init-stage2.sh\"'",
     ]
diff --git a/.gitlab-ci/lava/utils/uart_job_definition.py 
b/.gitlab-ci/lava/utils/uart_job_definition.py
index cd239c3215f..53cbd7a0485 100644
--- a/.gitlab-ci/lava/utils/uart_job_definition.py
+++ b/.gitlab-ci/lava/utils/uart_job_definition.py
@@ -150,7 +150,7 @@ def generate_lava_yaml_payload(args) -> dict[str, Any]:
         "sleep 1",
         # Putting CI_JOB name as the testcase name, it may help LAVA farm
         # maintainers with monitoring
-        f"lava-test-case 'mesa-ci_{args.mesa_job_name}' --shell 
/init-stage2.sh",
+        f"lava-test-case '{args.project_name}_{args.mesa_job_name}' --shell 
/init-stage2.sh",
     ]
 
     if args.boot_method == "fastboot":

Reply via email to