public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Magnus Granberg" <zorry@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/, buildbot_gentoo_ci/config/
Date: Sat, 28 May 2022 14:55:17 +0000 (UTC)	[thread overview]
Message-ID: <1653749690.1f57c498694cbdce80ad43b2b5a3c0c44cdee588.zorry@gentoo> (raw)

commit:     1f57c498694cbdce80ad43b2b5a3c0c44cdee588
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sat May 28 14:54:50 2022 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sat May 28 14:54:50 2022 +0000
URL:        https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=1f57c498

Add support for docker latent workers

Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>

 buildbot_gentoo_ci/config/workers.py | 39 ++++++++++++++++++++++++++++++++++--
 buildbot_gentoo_ci/steps/builders.py | 15 ++++++++------
 2 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/buildbot_gentoo_ci/config/workers.py b/buildbot_gentoo_ci/config/workers.py
index fbdc2a9..d4c20f7 100644
--- a/buildbot_gentoo_ci/config/workers.py
+++ b/buildbot_gentoo_ci/config/workers.py
@@ -1,7 +1,7 @@
-# Copyright 2021 Gentoo Authors
+# Copyright 2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-from buildbot.plugins import worker
+from buildbot.plugins import worker, util
 
 class gentoo_ci_workers():
     def __init__(self, worker_data, **kwargs):
@@ -47,17 +47,52 @@ class gentoo_ci_workers():
         print(node_worker)
         return node_worker
 
+@util.renderer
+def docker_images(props):
+    return 'bb-worker-' + props.getProperty('project_uuid') + ':latest'
+
+@util.renderer
+def docker_volumes(props):
+    volumes_list = []
+    #FIXME: set in master.cfg
+    src_dir = '/srv/gentoo/portage/' + props.getProperty('project_uuid')
+    dest_dir = '/var/cache/portage'
+    #add distdir
+    volumes_list.append(src_dir + '/distfiles' + ':' + dest_dir + '/distfiles')
+    #add bindir
+    volumes_list.append(src_dir + '/packages' + ':' + dest_dir + '/packages')
+    return volumes_list
+
 def gentoo_workers(worker_data):
     w = []
     g_ci_w = gentoo_ci_workers(worker_data)
     LocalWorkers = g_ci_w.getLocalWorkersUuid()
     BuildWorkers = g_ci_w.getBuildWorkersAllData()
     NodeWorkers = g_ci_w.getNodedWorkersAllData()
+    docker_hostconfig = {}
+    # For use of sandbox stuff
+    # FEATURES="ipc-sandbox network-sandbox pid-sandbox"
+    docker_hostconfig['cap_add'] = ['SYS_ADMIN', 'NET_ADMIN', 'SYS_PTRACE']
+    # libseccomp overhead
+    # https://github.com/seccomp/libseccomp/issues/153
+    docker_hostconfig['security_opt'] = ['seccomp=unconfined']
     for local_worker in LocalWorkers:
         w.append(worker.LocalWorker(local_worker))
     for build_worker in BuildWorkers:
         if build_worker['type'] == 'default':
             w.append(worker.Worker(build_worker['uuid'], build_worker['password']))
+        #FIXME: set settings in master.cfg
+        if build_worker['type'] == 'docker':
+            w.append(worker.DockerLatentWorker(build_worker['uuid'],
+                            build_worker['password'],
+                            docker_host='tcp://192.168.1.3:2375',
+                            image=docker_images,
+                            volumes=docker_volumes,
+                            hostconfig=docker_hostconfig,
+                            followStartupLogs=True,
+                            masterFQDN='192.168.1.5',
+                            build_wait_timeout=3600
+                            ))
     for node_worker in NodeWorkers:
         if node_worker['type'] == 'node':
             w.append(worker.Worker(node_worker['uuid'], node_worker['password']))

diff --git a/buildbot_gentoo_ci/steps/builders.py b/buildbot_gentoo_ci/steps/builders.py
index 8ce6545..1d4f52d 100644
--- a/buildbot_gentoo_ci/steps/builders.py
+++ b/buildbot_gentoo_ci/steps/builders.py
@@ -236,7 +236,8 @@ class TriggerRunBuildRequest(BuildStep):
                             'projectrepository_data' : self.projectrepository_data,
                             'use_data' : self.use_data,
                             'fullcheck' : self.getProperty("fullcheck"),
-                            'project_build_data' : project_build_data
+                            'project_build_data' : project_build_data,
+                            'project_uuid' : self.project_data['uuid']
                         }
                 )])
         return SUCCESS
@@ -384,6 +385,8 @@ class RunEmerge(BuildStep):
         self.descriptionSuffix = self.step
         self.name = 'Setup emerge for ' + self.step + ' step'
         self.build_env = {}
+        #FIXME: Set build timeout in config
+        self.build_timeout = 1800
 
     @defer.inlineCallbacks
     def run(self):
@@ -454,7 +457,7 @@ class RunEmerge(BuildStep):
                         strip=True,
                         extract_fn=PersOutputOfEmerge,
                         workdir='/',
-                        timeout=None
+                        timeout=self.build_timeout
                 ))
             aftersteps_list.append(CheckEmergeLogs('update'))
             if projects_emerge_options['preserved_libs']:
@@ -470,7 +473,7 @@ class RunEmerge(BuildStep):
                         strip=True,
                         extract_fn=PersOutputOfEmerge,
                         workdir='/',
-                        timeout=None
+                        timeout=self.build_timeout
                 ))
             aftersteps_list.append(CheckEmergeLogs('preserved-libs'))
             self.setProperty('preserved_libs', False, 'preserved-libs')
@@ -532,7 +535,7 @@ class RunEmerge(BuildStep):
                         strip=True,
                         extract_fn=PersOutputOfEmerge,
                         workdir='/',
-                        timeout=None
+                        timeout=self.build_timeout
                 ))
             aftersteps_list.append(CheckEmergeLogs('match'))
 
@@ -561,7 +564,7 @@ class RunEmerge(BuildStep):
                         strip=True,
                         extract_fn=PersOutputOfEmerge,
                         workdir='/',
-                        timeout=None
+                        timeout=self.build_timeout
                 ))
             aftersteps_list.append(CheckEmergeLogs('pre-build'))
 
@@ -588,7 +591,7 @@ class RunEmerge(BuildStep):
                         extract_fn=PersOutputOfEmerge,
                         workdir='/',
                         env=self.build_env,
-                        timeout=None
+                        timeout=self.build_timeout
                 ))
             aftersteps_list.append(CheckEmergeLogs('build'))
             if projects_emerge_options['preserved_libs']:


             reply	other threads:[~2022-05-28 14:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-28 14:55 Magnus Granberg [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-11-09 21:05 [gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/, buildbot_gentoo_ci/config/ Magnus Granberg
2022-09-01 14:57 Magnus Granberg
2021-12-24  0:33 Magnus Granberg
2021-10-07  9:17 Magnus Granberg
2021-05-02 15:24 Magnus Granberg
2021-04-04 20:30 Magnus Granberg
2021-04-04 20:30 Magnus Granberg
2021-03-24 23:15 Magnus Granberg
2021-03-18 23:18 Magnus Granberg

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1653749690.1f57c498694cbdce80ad43b2b5a3c0c44cdee588.zorry@gentoo \
    --to=zorry@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox