Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Also fetch LAVA job definition for watchjobs #1123

Merged

Conversation

swvanbuuren
Copy link
Contributor

Currently, the LAVA job definition is only fetched if the LAVA job is submitted directly through SQUAD (i.e. using a submitjob). This commit also implements this functionality for watchjobs.

Currently, the LAVA job definition is only fetched if the LAVA job is submitted
directly through SQUAD (i.e. using a submitjob). This commit also implements
this functionality for watchjobs.

Signed-off-by: Sietze van Buuren <[email protected]>
@mwasilew
Copy link
Contributor

LGTM

Copy link
Collaborator

@chaws chaws left a comment

Choose a reason for hiding this comment

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

LGTM

squad/ci/backend/null.py Outdated Show resolved Hide resolved
squad/ci/models.py Outdated Show resolved Hide resolved
squad/api/ci.py Outdated Show resolved Hide resolved
@chaws
Copy link
Collaborator

chaws commented Feb 6, 2024

Tests are failing because the testing backend is missing get_job_definition(). I came up with a quick fix in case you want to use it:

diff --git a/squad/ci/backend/fake.py b/squad/ci/backend/fake.py
index e49556bb..4b3100e2 100644
--- a/squad/ci/backend/fake.py
+++ b/squad/ci/backend/fake.py
@@ -66,5 +66,8 @@ class Backend(object):
     def check_job_definition(self, definition):
         return True
 
+    def get_job_definition(self, test_job):
+        return "sample job definition"
+
     def supports_callbacks(self):
         return False
diff --git a/test/api/test_ci.py b/test/api/test_ci.py
index 6ee36946..ba19fce3 100644
--- a/test/api/test_ci.py
+++ b/test/api/test_ci.py
@@ -238,6 +238,8 @@ class CiApiTest(TestCase):
             1,
             testjob_queryset.count()
         )
+        testjob = testjob_queryset.first()
+        self.assertTrue(len(testjob.definition) > 0)
         fetch.assert_called_with(testjob_queryset.first().id)
         logentry_queryset = LogEntry.objects.filter(
             user_id=self.project_privileged_user.pk,

- E.g. Tuxsuite does not have the concept of job definitions

Signed-off-by: Sietze van Buuren <[email protected]>
@swvanbuuren
Copy link
Contributor Author

Tests are failing because the testing backend is missing get_job_definition(). I came up with a quick fix in case you want to use it:

diff --git a/squad/ci/backend/fake.py b/squad/ci/backend/fake.py
...

Thank you for this. I have taken over your suggestion in commit f81c12f.

Tests seem to have passed.

@chaws chaws merged commit eb08b2b into Linaro:master Mar 5, 2024
7 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants