]> git.ipfire.org Git - pbs.git/commitdiff
jobs: Fix retrying jobs
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Jan 2025 14:32:35 +0000 (14:32 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Jan 2025 14:32:35 +0000 (14:32 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/jobs.py
src/templates/jobs/retry.html
src/web/jobs.py

index cfeadcaa03a75a89c12234d0eb69e78c75a7d0f0..69ed82294c671b82a5354ffad5f7b0e2e291c568 100644 (file)
@@ -924,11 +924,9 @@ class Job(database.Base, database.BackendMixin, database.SoftDeleteMixin):
                        superseeds = self,
                )
 
+               # Log action
                log.debug("Cloned job %s as %s" % (self, job))
 
-               # Update cache
-               self.build._jobs.append(job)
-
                return job
 
        # Retry
@@ -950,7 +948,7 @@ class Job(database.Base, database.BackendMixin, database.SoftDeleteMixin):
                        raise RuntimeError("Job %s cannot be retried" % self)
 
                # Clone the job
-               return self.clone()
+               return await self.clone()
 
        # Log
 
index a0406f86eec7aa7b04c7db7b7d80ac70e220faca..c87ca8e08df8d169139fcdcd1436567a443dca7c 100644 (file)
@@ -1,8 +1,8 @@
-{% extends "../base.html" %}
+{% extends "modal.html" %}
 
-{% block title %}{{ _("Retry Job %s") % job }}{% end block %}
+{% block title %}{{ _("Retry Job %s") % job }}{% endblock %}
 
-{% block container %}
+{% block breadcrumbs %}
        <nav class="breadcrumb" aria-label="breadcrumbs">
                <ul>
                        <li>
                        </li>
                </ul>
        </nav>
+{% endblock %}
 
-       <div class="columns is-centered">
-               <div class="column is-6">
-                       <form method="POST" action="">
-                               <div class="box">
-                                       {% raw xsrf_form_html() %}
+{% block modal_title %}
+       <h4 class="title is-4">{{ _("Retry Job") }}</h4>
+       <h6 class="subtitle is-6">{{ job }}</h6>
+{% endblock %}
 
-                                       <p class="title is-4">{{ _("Retry Job") }}</p>
-                                       <p class="subtitle is-5">
-                                               {{ _("Do you want to retry building %s?") % job }}
-                                       </p>
+{% block modal %}
+       <form method="POST" action="">
+               {{ xsrf_form_html() | safe }}
 
-                                       <button class="button is-fullwidth is-warning">
-                                               {{ _("Retry") }}
-                                       </button>
-                               </div>
-                       </form>
+               <div class="content">
+                       <p>
+                               {{ _("Do you want to retry building %s?") % job }}
+                       </p>
                </div>
-       </div>
-{% end block %}
+
+               {# Submit! #}
+               <div class="field">
+                       <button type="submit" class="button is-warning is-fullwidth">
+                               {{ _("Retry Job") }}
+                       </button>
+               </div>
+       </form>
+{% endblock %}
index 2ef8b8dd0d9622194e7638725e8470cc42c11dd9..3fb1d5889573e05dab0ae1ab9c2be90b23245199 100644 (file)
@@ -258,7 +258,7 @@ class RetryHandler(base.BaseHandler):
                if not job.has_perm(self.current_user):
                        raise tornado.web.HTTPError(403)
 
-               self.render("jobs/retry.html", job=job)
+               await self.render("jobs/retry.html", job=job)
 
        @base.authenticated
        async def post(self, uuid):
@@ -266,11 +266,11 @@ class RetryHandler(base.BaseHandler):
                if not job:
                        raise tornado.web.HTTPError(404, "Could not find job %s" % uuid)
 
-               async with await self.db.transaction():
-                       job = await job.retry(self.current_user)
+               # Retry the job
+               job = await job.retry(self.current_user)
 
-                       # Launch the newly created job
-                       await self.backend.jobs.launch([job])
+               # Launch the newly created job
+               await self.backend.jobs.launch([job])
 
                # Redirect back to the build page
                self.redirect("/builds/%s" % job.build.uuid)