From: Romain GARBAGE <romain.garbage@inria.fr>
To: 74769@debbugs.gnu.org
Cc: ludovic.courtes@inria.fr, Romain GARBAGE <romain.garbage@inria.fr>
Subject: [bug#74769] [PATCH Cuirass v2 4/7] forges: Define default values for specifications.
Date: Thu, 12 Dec 2024 16:57:52 +0100 [thread overview]
Message-ID: <20241212155845.27344-4-romain.garbage@inria.fr> (raw)
In-Reply-To: <20241212155845.27344-1-romain.garbage@inria.fr>
* src/cuirass/forges.scm (%default-jobset-options-period,
%default-jobset-options-priority, %default-jobset-options-systems): New
variables.
* src/cuirass/forges/gitlab.scm (gitlab-merge-request->specification),
tests/gitlab.scm: Change hardcoded values to variables defined in the forges
module.
---
src/cuirass/forges.scm | 16 +++++++++++++++-
src/cuirass/forges/gitlab.scm | 6 +++---
tests/gitlab.scm | 21 +++++++++++----------
3 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/src/cuirass/forges.scm b/src/cuirass/forges.scm
index c05e266..56f4876 100644
--- a/src/cuirass/forges.scm
+++ b/src/cuirass/forges.scm
@@ -20,7 +20,11 @@
#:use-module (cuirass specification)
#:use-module (json)
#:use-module (ice-9 match)
- #:export (make-jobset-options
+ #:export (%default-jobset-options-period
+ %default-jobset-options-priority
+ %default-jobset-options-systems
+
+ make-jobset-options
jobset-options?
json->jobset-options
jobset-options-name-prefix
@@ -36,6 +40,16 @@
;;;
;;; Code:
+;; Default polling period for jobsets created using a forge module.
+(define %default-jobset-options-period 3600)
+
+;; Default priority for jobsets created using a forge module.
+(define %default-jobset-options-priority 5)
+
+;; Default target systems for jobsets created using a forge module.
+(define %default-jobset-options-systems
+ (list "x86_64-linux"))
+
;; This mapping defines a specific JSON dictionary used for tweaking Cuirass
;; options. It is not included in the JSON data sent by default by Gitlab and
;; must be used through the custom template mechanism (see documentation).
diff --git a/src/cuirass/forges/gitlab.scm b/src/cuirass/forges/gitlab.scm
index 56e875a..de2216f 100644
--- a/src/cuirass/forges/gitlab.scm
+++ b/src/cuirass/forges/gitlab.scm
@@ -123,15 +123,15 @@
(period (if (and cuirass-options
(jobset-options-period cuirass-options))
(jobset-options-period cuirass-options)
- 3600))
+ %default-jobset-options-period))
(priority (if (and cuirass-options
(jobset-options-priority cuirass-options))
(jobset-options-priority cuirass-options)
- 1))
+ %default-jobset-options-priority))
(systems (if (and cuirass-options
(jobset-options-systems cuirass-options))
(jobset-options-systems cuirass-options)
- (list "x86_64-linux"))))
+ %default-jobset-options-systems)))
(specification
(name spec-name)
(build build)
diff --git a/tests/gitlab.scm b/tests/gitlab.scm
index df221bf..3409413 100644
--- a/tests/gitlab.scm
+++ b/tests/gitlab.scm
@@ -16,7 +16,8 @@
;;; You should have received a copy of the GNU General Public License
;;; along with Cuirass. If not, see <http://www.gnu.org/licenses/>.
-(use-modules (cuirass forges gitlab)
+(use-modules (cuirass forges)
+ (cuirass forges gitlab)
(cuirass specification)
(cuirass utils)
(tests common)
@@ -172,9 +173,9 @@
(url "https://gitlab.instance.test/source-repo/fork-name.git")
(branch "test-branch"))
%default-channels))
- (priority 1)
- (period 3600)
- (systems (list "x86_64-linux")))))
+ (priority %default-jobset-options-priority)
+ (period %default-jobset-options-period)
+ (systems %default-jobset-options-systems))))
(test-assert "custom-json"
(specifications=?
@@ -211,9 +212,9 @@
(url "https://gitlab.instance.test/source-repo/fork-name.git")
(branch "test-branch"))
%default-channels))
- (priority 1)
- (period 3600)
- (systems (list "x86_64-linux")))))
+ (priority %default-jobset-options-priority)
+ (period %default-jobset-options-period)
+ (systems %default-jobset-options-systems))))
(test-assert "custom-json-name-prefix"
(specifications=?
@@ -230,9 +231,9 @@
(url "https://gitlab.instance.test/source-repo/fork-name.git")
(branch "test-branch"))
%default-channels))
- (priority 1)
- (period 3600)
- (systems (list "x86_64-linux")))))
+ (priority %default-jobset-options-priority)
+ (period %default-jobset-options-period)
+ (systems %default-jobset-options-systems))))
(test-assert "custom-json-build-all"
(specifications=?
--
2.46.0
next prev parent reply other threads:[~2024-12-12 16:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 16:01 [bug#74769] [PATCH Cuirass 0/4] Forgejo event support Romain GARBAGE
2024-12-10 16:09 ` [bug#74769] [PATCH Cuirass 1/4] tests: Move procedure definition Romain GARBAGE
2024-12-10 16:09 ` [bug#74769] [PATCH Cuirass 2/4] forgejo: Add module for Forgejo JSON objects definition Romain GARBAGE
2024-12-12 13:34 ` Ludovic Courtès
2024-12-10 16:09 ` [bug#74769] [PATCH Cuirass 3/4] tests: Explicit Gitlab endpoint related variables Romain GARBAGE
2024-12-10 16:09 ` [bug#74769] [PATCH Cuirass 4/4] http: Add admin/forgejo/event Romain GARBAGE
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 1/7] tests: Move procedure definition Romain GARBAGE
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 2/7] tests: Rename specifications-equal? procedure Romain GARBAGE
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 3/7] forges: Add module for common forges utilities Romain GARBAGE
2024-12-12 15:57 ` Romain GARBAGE [this message]
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 5/7] forgejo: Add module for Forgejo JSON objects definition Romain GARBAGE
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 6/7] tests: Explicit Gitlab endpoint related variables Romain GARBAGE
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 7/7] http: Add admin/forgejo/event Romain GARBAGE
2024-12-13 10:17 ` bug#74769: [PATCH Cuirass v2 1/7] tests: Move procedure definition Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241212155845.27344-4-romain.garbage@inria.fr \
--to=romain.garbage@inria.fr \
--cc=74769@debbugs.gnu.org \
--cc=ludovic.courtes@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).