diff options
Diffstat (limited to 'buildbot_gentoo_ci')
-rw-r--r-- | buildbot_gentoo_ci/config/schedulers.py | 5 | ||||
-rw-r--r-- | buildbot_gentoo_ci/db/model.py | 1 | ||||
-rw-r--r-- | buildbot_gentoo_ci/db/versions.py | 6 | ||||
-rw-r--r-- | buildbot_gentoo_ci/steps/logs.py | 26 | ||||
-rw-r--r-- | buildbot_gentoo_ci/steps/version.py | 4 |
5 files changed, 34 insertions, 8 deletions
diff --git a/buildbot_gentoo_ci/config/schedulers.py b/buildbot_gentoo_ci/config/schedulers.py index c34d714..a4180cc 100644 --- a/buildbot_gentoo_ci/config/schedulers.py +++ b/buildbot_gentoo_ci/config/schedulers.py @@ -40,19 +40,20 @@ def getGitChanges(props): change_data['timestamp'] = k['when_timestamp'] change_data['branch'] = k['branch'] change_data['project'] = k['project'] + change_data['change_id'] = k['changeid'] return change_data def bb_branch_fn(branch): # check branch print(f"Branch: {branch}") - if branch.endswith('-mr') or branch.endswith('-pr') or branch == 'master': + if branch.endswith('-mr') or branch.endswith('-pr') or branch.endswith('master') or branch.endswith('main'): return True return False def bb_category_fn(category): # check event print(f"Category: {category}") - if category == 'push' or category == 'merge_request': + if category == 'push' or category == 'merge_request' or category is None: return True return False diff --git a/buildbot_gentoo_ci/db/model.py b/buildbot_gentoo_ci/db/model.py index b6a0c43..dea3e15 100644 --- a/buildbot_gentoo_ci/db/model.py +++ b/buildbot_gentoo_ci/db/model.py @@ -348,6 +348,7 @@ class Model(base.DBConnectorComponent): nullable=False), sa.Column('file_hash', sa.String(255), nullable=False), sa.Column('commit_id', sa.String(255), nullable=False), + sa.Column('change_id', sa.Integer, nullable=True, default=0), sa.Column('deleted', sa.Boolean, default=False), sa.Column('deleted_at', sa.Integer, nullable=True), ) diff --git a/buildbot_gentoo_ci/db/versions.py b/buildbot_gentoo_ci/db/versions.py index 0aaac1b..8d35602 100644 --- a/buildbot_gentoo_ci/db/versions.py +++ b/buildbot_gentoo_ci/db/versions.py @@ -55,7 +55,7 @@ class VersionsConnectorComponent(base.DBConnectorComponent): return res @defer.inlineCallbacks - def addVersion(self, name, package_uuid, file_hash, commit_id): + def addVersion(self, name, package_uuid, file_hash, commit_id, change_id): def thd(conn, no_recurse=False): try: tbl = self.db.model.versions @@ -63,7 +63,8 @@ class VersionsConnectorComponent(base.DBConnectorComponent): r = conn.execute(q, dict(name=name, package_uuid=package_uuid, file_hash=file_hash, - commit_id=commit_id)) + commit_id=commit_id, + change_id=change_id)) except (sa.exc.IntegrityError, sa.exc.ProgrammingError): uuid = None else: @@ -178,6 +179,7 @@ class VersionsConnectorComponent(base.DBConnectorComponent): package_uuid=row.package_uuid, file_hash=row.file_hash, commit_id=row.commit_id, + change_id = row.change_id, deleted=row.deleted, deleted_at=row.deleted_at ) diff --git a/buildbot_gentoo_ci/steps/logs.py b/buildbot_gentoo_ci/steps/logs.py index aacb8a5..34aee29 100644 --- a/buildbot_gentoo_ci/steps/logs.py +++ b/buildbot_gentoo_ci/steps/logs.py @@ -250,6 +250,7 @@ class MakeIssue(BuildStep): self.summary_log_list = [] self.error_dict = {} self.aftersteps_list = [] + Maintainers = [] #self.error_dict['hash'] = hashlib.sha256() for k, v in sorted(self.summary_log_dict.items()): self.summary_log_list.append(v['text']) @@ -263,11 +264,30 @@ class MakeIssue(BuildStep): self.error_dict['phase'] = v['text'].split(' (')[1].split(' phase')[0] error = True if v['text'].startswith(' * Maintainer:'): - Maintainers = [] for email in v['text'].split(':')[1].split(' '): if email != '': - Maintainers.append(email) - self.setProperty("Maintainers", Maintainers, 'Maintainers') + for e in email.split(','): + Maintainers.append(email) + # make a emails dict + emails = {} + emails['maintainers'] = Maintainers + emails['owners'] = self.getProperty('owners') + emails['packages_emails'] = [] + pmail_ids = yield self.gentooci.db.packages.getEmailsIdsByPackageUuid(self.getProperty("version_data")['package_uuid']) + for pmail_id in pmail_ids: + pmail = yield self.gentooci.db.packages.getEmailByEmailId(pmail_id['email_id']) + emails['packages_emails'].append(pmail['email']) + changes = yield self.master.db.changes.getChange(self.getProperty("version_data")['change_id']) + cemail = {} + cemail['authors'] = changes['author'] + #cemail['committer'] = changes['committer'] + cemail['changes_uids_email'] = [] + changes_uids = yield self.master.db.changes.getChangeUids(self.getProperty("version_data")['change_id']) + for changes_uid in changes_uids: + cuemail = yield self.master.db.users.getUser(changes_uid) + cemail['changes_uids_email'].append(cuemail['identifier']) + emails['change'] = cemail + self.setProperty("emails", emails, 'emails') #FIXME: write summary_log_list to a file # add issue/bug/pr report if error: diff --git a/buildbot_gentoo_ci/steps/version.py b/buildbot_gentoo_ci/steps/version.py index 98e5403..5f252c7 100644 --- a/buildbot_gentoo_ci/steps/version.py +++ b/buildbot_gentoo_ci/steps/version.py @@ -151,11 +151,13 @@ class AddVersion(BuildStep): self.version_data['package_uuid'] = self.getProperty("package_data")['uuid'] self.version_data['file_hash'] = 'None' self.version_data['commit_id'] = self.getProperty("commit_id") + self.version_data['change_id'] = self.getProperty("change_data")['change_id'] self.version_data['uuid'] = yield self.gentooci.db.versions.addVersion( self.version_data['name'], self.version_data['package_uuid'], self.version_data['file_hash'], - self.version_data['commit_id'] + self.version_data['commit_id'], + self.version_data['change_id'] ) print(self.version_data) self.setProperty("version_data", self.version_data, 'version_data') |