From b09c6350d3c98b8569a194f229b515d0508e8c35 Mon Sep 17 00:00:00 2001 From: Magnus Granberg Date: Mon, 1 May 2023 11:58:12 +0200 Subject: Add support for shallow in repositorys Signed-off-by: Magnus Granberg --- buildbot_gentoo_ci/db/model.py | 3 ++- buildbot_gentoo_ci/db/repositorys.py | 9 ++++++++- buildbot_gentoo_ci/steps/repos.py | 3 ++- sql/gentoo_ci_schema.sql | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/buildbot_gentoo_ci/db/model.py b/buildbot_gentoo_ci/db/model.py index 6e13ad7..7ffe0ca 100644 --- a/buildbot_gentoo_ci/db/model.py +++ b/buildbot_gentoo_ci/db/model.py @@ -15,7 +15,7 @@ # Copyright Buildbot Team Members # Origins: buildbot.db.model.py # Modifyed by Gentoo Authors. -# Copyright 2020 Gentoo Authors +# Copyright 2023 Gentoo Authors import uuid import migrate @@ -75,6 +75,7 @@ class Model(base.DBConnectorComponent): sa.Column('type', sa.Enum('git', 'gitlab'), nullable=False, default='git'), sa.Column('mode', sa.Enum('full', 'incremental'), nullable=False, default='incremental'), sa.Column('method', sa.Enum('clobber', 'fresh', 'clean', 'copy'), nullable=False, default='fresh'), + sa.Column('shallow', sa.Integer, nullable=False, default=0), sa.Column('alwaysuselatest', sa.Boolean, default=False), sa.Column('auto', sa.Boolean, default=False), sa.Column('enabled', sa.Boolean, default=False), diff --git a/buildbot_gentoo_ci/db/repositorys.py b/buildbot_gentoo_ci/db/repositorys.py index 4d5d048..8fee1d3 100644 --- a/buildbot_gentoo_ci/db/repositorys.py +++ b/buildbot_gentoo_ci/db/repositorys.py @@ -15,7 +15,7 @@ # Copyright Buildbot Team Members # Origins: buildbot.db.* # Modifyed by Gentoo Authors. -# Copyright 2021 Gentoo Authors +# Copyright 2023 Gentoo Authors import sqlalchemy as sa @@ -101,6 +101,12 @@ class RepositorysConnectorComponent(base.DBConnectorComponent): else: sshprivatekey = row.sshprivatekey sshhostkey = row.sshhostkey + if row.shallow == 0: + shallow = False + elif row.shallow == 1: + shallow = True + else: + shallow = row.shallow return dict( uuid=row.uuid, name=row.name, @@ -110,6 +116,7 @@ class RepositorysConnectorComponent(base.DBConnectorComponent): branch=branch, mode=row.mode, method=row.method, + shallow=shallow, alwaysuselatest=row.alwaysuselatest, auto=row.auto, enabled=row.enabled, diff --git a/buildbot_gentoo_ci/steps/repos.py b/buildbot_gentoo_ci/steps/repos.py index 04b25d7..6d37906 100644 --- a/buildbot_gentoo_ci/steps/repos.py +++ b/buildbot_gentoo_ci/steps/repos.py @@ -1,4 +1,4 @@ -# Copyright 2021 Gentoo Authors +# Copyright 2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import os @@ -216,6 +216,7 @@ class UpdateRepos(BuildStep): branch = branch, mode=repository_data['mode'], method=repository_data['method'], + shallow=repository_data['shallow'], submodules=True, alwaysUseLatest=repository_data['alwaysuselatest'], workdir=repository_path, diff --git a/sql/gentoo_ci_schema.sql b/sql/gentoo_ci_schema.sql index 7de44ba..b166150 100644 --- a/sql/gentoo_ci_schema.sql +++ b/sql/gentoo_ci_schema.sql @@ -815,6 +815,7 @@ CREATE TABLE public.repositorys ( branch character varying(255), mode public.repositorys_mode, method public.repositorys_method, + shallow integer NOT NULL, alwaysuselatest boolean, merge boolean, sshprivatekey character varying(50), -- cgit v1.2.3-65-gdbad