Skip to content

Commit

Permalink
Merge pull request #5512 from p12tic/2.8-fix-codebase-None-assertion
Browse files Browse the repository at this point in the history
2.8: Fix incomplete codebase support in Gerrit
  • Loading branch information
p12tic committed Aug 29, 2020
2 parents 5e9c0b1 + e91beab commit 42c077b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions master/buildbot/changes/gerritchangesource.py
Expand Up @@ -171,6 +171,7 @@ def addChange(self, chdict):
"patch_comment": chdict["comments"],
"repository": chdict["repository"],
"project": chdict["project"],
"codebase": '',
}

stampid, found_existing = yield(
Expand Down
@@ -0,0 +1,2 @@
Work around incomplete support for codebases in GerritChangeSource (:issue:`5190`). This avoids an internal assertion when the configuration file does not specify any codebases.

5 changes: 5 additions & 0 deletions master/buildbot/test/fakedb/sourcestamps.py
Expand Up @@ -98,6 +98,11 @@ def findOrCreateId(self, branch=None, revision=None, repository=None,
patch_body=None, patch_level=None,
patch_author=None, patch_comment=None,
patch_subdir=None):

assert codebase is not None, "codebase cannot be None"
assert project is not None, "project cannot be None"
assert repository is not None, "repository cannot be None"

if patch_body:
patchid = len(self.patches) + 1
while patchid in self.patches:
Expand Down
10 changes: 7 additions & 3 deletions master/buildbot/test/integration/test_custom_buildstep.py
Expand Up @@ -194,9 +194,13 @@ def setUp(self):
yield wfb.attached(self.worker, {})

# add the buildset/request
self.bsid, brids = yield self.master.db.buildsets.addBuildset(
sourcestamps=[{}], reason='x', properties={},
builderids=[80], waited_for=False)
sourcestamps = [
{'repository': '', 'project': '', 'codebase': ''}
]
self.bsid, brids = yield self.master.db.buildsets.addBuildset(sourcestamps=sourcestamps,
reason='x', properties={},
builderids=[80],
waited_for=False)

self.brdict = \
yield self.master.db.buildrequests.getBuildRequest(brids[80])
Expand Down

0 comments on commit 42c077b

Please sign in to comment.