mirror of
				https://codeberg.org/hako/Rosenthal.git
				synced 2025-11-04 11:44:48 +00:00 
			
		
		
		
	services: cuirass-worker-container: Clean up.
* modules/rosenthal/services/cuirass.scm (cuirass-service-type/hako): New variable. (cuirass-worker-container-service-type): Clean up.
This commit is contained in:
		
							parent
							
								
									cc202637fd
								
							
						
					
					
						commit
						c87e5521de
					
				@ -4,6 +4,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
(define-module (rosenthal services cuirass)
 | 
					(define-module (rosenthal services cuirass)
 | 
				
			||||||
  #:use-module (srfi srfi-1)
 | 
					  #:use-module (srfi srfi-1)
 | 
				
			||||||
 | 
					  #:use-module (srfi srfi-26)
 | 
				
			||||||
  #:use-module (guix gexp)
 | 
					  #:use-module (guix gexp)
 | 
				
			||||||
  #:use-module (guix modules)
 | 
					  #:use-module (guix modules)
 | 
				
			||||||
  #:use-module (guix records)
 | 
					  #:use-module (guix records)
 | 
				
			||||||
@ -19,20 +20,63 @@
 | 
				
			|||||||
  #:use-module (gnu services admin)
 | 
					  #:use-module (gnu services admin)
 | 
				
			||||||
  #:use-module (gnu services base)
 | 
					  #:use-module (gnu services base)
 | 
				
			||||||
  #:use-module (gnu services cuirass)
 | 
					  #:use-module (gnu services cuirass)
 | 
				
			||||||
 | 
					  #:use-module (gnu services databases)
 | 
				
			||||||
  #:use-module (gnu services shepherd)
 | 
					  #:use-module (gnu services shepherd)
 | 
				
			||||||
  #:use-module (gnu packages linux)
 | 
					  #:use-module (gnu packages linux)
 | 
				
			||||||
  #:export (cuirass-worker-container-configuration
 | 
					  #:export (cuirass-worker-container-service-type
 | 
				
			||||||
 | 
					            cuirass-worker-container-configuration
 | 
				
			||||||
            cuirass-worker-container-configuration?
 | 
					            cuirass-worker-container-configuration?
 | 
				
			||||||
            this-cuirass-worker-container-configuration
 | 
					            this-cuirass-worker-container-configuration
 | 
				
			||||||
            cuirass-worker-container-host-name
 | 
					 | 
				
			||||||
            cuirass-worker-container-server
 | 
					 | 
				
			||||||
            cuirass-worker-container-supported-systems
 | 
					 | 
				
			||||||
            cuirass-worker-container-substitute-urls
 | 
					 | 
				
			||||||
            cuirass-worker-container-script
 | 
					 | 
				
			||||||
            cuirass-worker-container-activation
 | 
					            cuirass-worker-container-activation
 | 
				
			||||||
            cuirass-worker-container-shepherd
 | 
					            cuirass-worker-container-shepherd
 | 
				
			||||||
            cuirass-worker-container-service-type))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            cuirass-service-type/hako))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;
 | 
				
			||||||
 | 
					;;; Cuirass service with ‘avahi-daemon’ shepherd requirement stripped.
 | 
				
			||||||
 | 
					;;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define cuirass-service-type/hako
 | 
				
			||||||
 | 
					  (let ((cuirass-configuration-cuirass
 | 
				
			||||||
 | 
					         (@@ (gnu services cuirass) cuirass-configuration-cuirass))
 | 
				
			||||||
 | 
					        (cuirass-activation
 | 
				
			||||||
 | 
					         (@@ (gnu services cuirass) cuirass-activation))
 | 
				
			||||||
 | 
					        (cuirass-shepherd-service
 | 
				
			||||||
 | 
					         (@@ (gnu services cuirass) cuirass-shepherd-service))
 | 
				
			||||||
 | 
					        (cuirass-account
 | 
				
			||||||
 | 
					         (@@ (gnu services cuirass) cuirass-account))
 | 
				
			||||||
 | 
					        (cuirass-postgresql-role
 | 
				
			||||||
 | 
					         (@@ (gnu services cuirass) cuirass-postgresql-role))
 | 
				
			||||||
 | 
					        (strip-shepherd-requirement
 | 
				
			||||||
 | 
					         (lambda (services)
 | 
				
			||||||
 | 
					           (map (lambda (service)
 | 
				
			||||||
 | 
					                  (if (member 'cuirass-remote-server
 | 
				
			||||||
 | 
					                              (shepherd-service-provision service))
 | 
				
			||||||
 | 
					                      (shepherd-service
 | 
				
			||||||
 | 
					                        (inherit service)
 | 
				
			||||||
 | 
					                        (requirement
 | 
				
			||||||
 | 
					                         (remove (cut eqv? <> 'avahi-daemon)
 | 
				
			||||||
 | 
					                                 (shepherd-service-requirement service))))
 | 
				
			||||||
 | 
					                      service))
 | 
				
			||||||
 | 
					                services))))
 | 
				
			||||||
 | 
					    (service-type
 | 
				
			||||||
 | 
					     (name 'cuirass)
 | 
				
			||||||
 | 
					     (extensions
 | 
				
			||||||
 | 
					      (list
 | 
				
			||||||
 | 
					       (service-extension profile-service-type      ;for 'info cuirass'
 | 
				
			||||||
 | 
					                          (compose list cuirass-configuration-cuirass))
 | 
				
			||||||
 | 
					       (service-extension activation-service-type cuirass-activation)
 | 
				
			||||||
 | 
					       (service-extension shepherd-root-service-type
 | 
				
			||||||
 | 
					                          (compose strip-shepherd-requirement
 | 
				
			||||||
 | 
					                                   cuirass-shepherd-service))
 | 
				
			||||||
 | 
					       (service-extension account-service-type cuirass-account)
 | 
				
			||||||
 | 
					       ;; Make sure postgresql and postgresql-role are instantiated.
 | 
				
			||||||
 | 
					       (service-extension postgresql-service-type (const #t))
 | 
				
			||||||
 | 
					       (service-extension postgresql-role-service-type
 | 
				
			||||||
 | 
					                          cuirass-postgresql-role)))
 | 
				
			||||||
 | 
					     (description "Run the Cuirass continuous integration service."))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;; Run Cuirass remote worker in container.
 | 
					;;; Run Cuirass remote worker in container.
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
@ -70,34 +114,33 @@
 | 
				
			|||||||
  (match-record-lambda <cuirass-worker-container-configuration>
 | 
					  (match-record-lambda <cuirass-worker-container-configuration>
 | 
				
			||||||
      (host-name server workers supported-systems substitute-urls)
 | 
					      (host-name server workers supported-systems substitute-urls)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    (define cuirass-remote-worker-shepherd-service
 | 
				
			||||||
 | 
					      (@@ (gnu services cuirass) cuirass-remote-worker-shepherd-service))
 | 
				
			||||||
 | 
					    (define %cuirass-remote-worker-accounts
 | 
				
			||||||
 | 
					      (@@ (gnu services cuirass) %cuirass-remote-worker-accounts))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    (define (strip-shepherd-requirement services)
 | 
				
			||||||
 | 
					      (map (lambda (service)
 | 
				
			||||||
 | 
					             (if (member 'cuirass-remote-worker
 | 
				
			||||||
 | 
					                         (shepherd-service-provision service))
 | 
				
			||||||
 | 
					                 (shepherd-service
 | 
				
			||||||
 | 
					                   (inherit service)
 | 
				
			||||||
 | 
					                   (requirement
 | 
				
			||||||
 | 
					                    (remove (cut member <> '(avahi-daemon guix-daemon))
 | 
				
			||||||
 | 
					                            (shepherd-service-requirement service))))
 | 
				
			||||||
 | 
					                 service))
 | 
				
			||||||
 | 
					           services))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    (define cuirass-remote-worker-for-container
 | 
					    (define cuirass-remote-worker-for-container
 | 
				
			||||||
      (service-type
 | 
					      (service-type
 | 
				
			||||||
       (name 'cuirass-remote-worker)
 | 
					       (name 'cuirass-remote-worker)
 | 
				
			||||||
       (extensions
 | 
					       (extensions
 | 
				
			||||||
        (list (service-extension shepherd-root-service-type
 | 
					        (list (service-extension shepherd-root-service-type
 | 
				
			||||||
                                 (compose
 | 
					                                 (compose strip-shepherd-requirement
 | 
				
			||||||
                                  (lambda (services)
 | 
					                                          cuirass-remote-worker-shepherd-service))
 | 
				
			||||||
                                    (map
 | 
					 | 
				
			||||||
                                     (lambda (s)
 | 
					 | 
				
			||||||
                                       (if (member 'cuirass-remote-worker
 | 
					 | 
				
			||||||
                                                   (shepherd-service-provision s))
 | 
					 | 
				
			||||||
                                           (shepherd-service
 | 
					 | 
				
			||||||
                                             (inherit s)
 | 
					 | 
				
			||||||
                                             (requirement
 | 
					 | 
				
			||||||
                                              (lset-difference
 | 
					 | 
				
			||||||
                                               eqv?
 | 
					 | 
				
			||||||
                                               (shepherd-service-requirement s)
 | 
					 | 
				
			||||||
                                               '(avahi-daemon guix-daemon))))
 | 
					 | 
				
			||||||
                                           s))
 | 
					 | 
				
			||||||
                                     services))
 | 
					 | 
				
			||||||
                                  (@@ (gnu services cuirass)
 | 
					 | 
				
			||||||
                                      cuirass-remote-worker-shepherd-service)))
 | 
					 | 
				
			||||||
              (service-extension account-service-type
 | 
					              (service-extension account-service-type
 | 
				
			||||||
                                 (const
 | 
					                                 (const %cuirass-remote-worker-accounts))))
 | 
				
			||||||
                                  (@@ (gnu services cuirass)
 | 
					       (description "Run the Cuirass remote build worker service.")))
 | 
				
			||||||
                                      %cuirass-remote-worker-accounts)))))
 | 
					 | 
				
			||||||
       (description
 | 
					 | 
				
			||||||
        "Run the Cuirass remote build worker service.")))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    (define os
 | 
					    (define os
 | 
				
			||||||
      (operating-system
 | 
					      (operating-system
 | 
				
			||||||
@ -123,6 +166,7 @@
 | 
				
			|||||||
                   (publish-port 5558)
 | 
					                   (publish-port 5558)
 | 
				
			||||||
                   (substitute-urls substitute-urls)))
 | 
					                   (substitute-urls substitute-urls)))
 | 
				
			||||||
               %base-services))))
 | 
					               %base-services))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    (with-store store
 | 
					    (with-store store
 | 
				
			||||||
      (run-with-store store
 | 
					      (run-with-store store
 | 
				
			||||||
        (container-script os #:shared-network? #t)))))
 | 
					        (container-script os #:shared-network? #t)))))
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user