Skip to content

Instantly share code, notes, and snippets.

@kwk

kwk/README.md Secret

Created January 14, 2021 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwk/7cf03b68f07be1ed9fac7bf5b23db28f to your computer and use it in GitHub Desktop.
Save kwk/7cf03b68f07be1ed9fac7bf5b23db28f to your computer and use it in GitHub Desktop.
GitHubCommentPush

I'm getting the following error and I wonder how to pass along the GitHub repoOwner correctly. Apparently it is None at the moment.

Updating github status: repoOwner=None, repoName=MyRepo
Failed to update "pending" for None/MyRepo at main, context "", issue None. http n/a, n/a
Traceback (most recent call last):
  File "/usr/lib64/python3.9/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator
    return _cancellableInlineCallbacks(gen)
  File "/usr/lib64/python3.9/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks
    _inlineCallbacks(None, g, status)
  File "/usr/lib64/python3.9/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/usr/lib/python3.9/site-packages/buildbot/reporters/github.py", line 183, in send
    log.err(
--- <exception caught here> ---
  File "/usr/lib/python3.9/site-packages/buildbot/reporters/github.py", line 157, in send
    response = yield self.createStatus(
  File "/usr/lib/python3.9/site-packages/buildbot/reporters/github.py", line 221, in createStatus
    '/'.join(['/repos', repo_user, repo_name, 'issues', issue, 'comments']),
builtins.TypeError: sequence item 1: expected str instance, NoneType found

acquireLocks(worker <Worker 'worker0'>, locks [])
starting build <Build trybuilder0 number:6 results:success>.. pinging the worker <WorkerForBuilder builder='trybuilder0' worker='worker0' state=BUILDING>
@util.renderer
@defer.inlineCallbacks
def getresults(props):
all_logs=[]
master = props.master
steps = yield props.master.data.get(
('builders', props.getProperty('buildername'), 'builds',
props.getProperty('buildnumber'), 'steps'))
for step in steps:
if step['results'] == util.Results.index('failure'):
logs = yield master.data.get(("steps", step['stepid'], 'logs'))
for l in logs:
all_logs.append('Step : {0} Result : {1}'.format(
step['name'], util.Results[step['results']]))
all_logs.append('```')
l['stepname'] = step['name']
l['content'] = yield master.data.get(("logs", l['logid'], 'contents'))
step_logs = l['content']['content'].split('\n')
include = False
for i, sl in enumerate(step_logs):
all_logs.append(sl[1:])
all_logs.append('```')
return '\n'.join(all_logs)
c['services'].append(reporters.GitHubCommentPush(
# token=util.Secret("github-pat"),
token=github_pat_write_discussion,
startDescription='Build started.',
endDescription='Build done.',
verbose=True, # logs a message for each successful status push
debug=True, # logs every requests and their response
verify=False, # disable ssl verification for the case you use temporary self signed certificates
builders=['trybuilder0', 'trybuilder1'],
context=Interpolate('buildbot/%(prop:buildername)s')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment