<div dir="ltr">Normally the project name should not be used by buildbot_travis.<div><br></div><div>I think the problem is that indeed, buildbot_travis setups the change filters so that it matches the http url, and not ssh url.<div><br></div><div>Another option is to use https instead of ssh to download the source code.</div><div><br></div><div>You can the use the .gitconfig insteadOf trick in your worker environment in order to tell git to use a https authentication token.</div><div><br></div><div><a href="https://github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth">https://github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth</a><br></div><div><br></div><div><table class="inbox-inbox-highlight inbox-inbox-tab-size inbox-inbox-js-file-line-container" style="box-sizing:border-box;border-collapse:collapse;color:rgb(36,41,46);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"></tr><tr style="box-sizing:border-box"><td id="inbox-inbox-file-npm-using-https-for-git-sh-LC1" class="inbox-inbox-blob-code inbox-inbox-blob-code-inner inbox-inbox-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre">git config --global url.<span class="inbox-inbox-pl-s" style="box-sizing:border-box;color:rgb(3,47,98)"><span class="inbox-inbox-pl-pds" style="box-sizing:border-box">"</span>https://<token>@<a href="http://github.com/">github.com/</a><span class="inbox-inbox-pl-pds" style="box-sizing:border-box">"</span></span>.insteadOf <a href="https://github.com/">https://github.com/</a>

<a href="https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/">https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/</a>
</td></tr><tr style="box-sizing:border-box"><td id="inbox-inbox-file-npm-using-https-for-git-sh-L2" class="inbox-inbox-blob-num inbox-inbox-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"><br>I</td></tr></tbody></table>Pierre</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jan 24, 2018 at 5:37 PM David Alves <<a href="mailto:davidralves@gmail.com">davidralves@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've managed to sort this out, so leaving it here for future reference.<br>
<br>
Turns out there were two problems. The first was that I was using a<br>
git@ url, as the bot needed to download the repo through ssh.<br>
The hook matches the remote repo with the local repo based on the<br>
url so these didn't match and nothing would trigger.<br>
The second problem was that the project's name didn't match.<br>
The hook returns <owner>/<repo name> as the project name,<br>
but the project can only have <repo name> as the slash is illegal<br>
so the project would be found but it would ignore this update.<br>
<br>
My solution was to subclass the github event handler and rewrite<br>
the payload to make these match. It's kind of hacky but it works.<br>
Any suggestions on how to do this better are welcome.<br>
<br>
class CustomGitHubEventHandler(GitHubEventHandler):<br>
    """<br>
    Decorated GitHubEventHandler to be able to use a git@ url and<br>
    a project name that doesn't contain the owner.<br>
    """<br>
    def handle_pull_request(self, payload, event):<br>
        # Swap the repository url from the html one to the ssh one.<br>
        # We need it to be the ssh one so that infra-bot can login,<br>
but if they don't match<br>
        # builds wont be triggered.<br>
        payload['repository']['html_url'] = payload['repository']['ssh_url']<br>
        # Swap the project name with the "short" name, we can't use<br>
the full name to name projects<br>
        # in buildbot and if it gets the wrong name it won't build.<br>
        payload['pull_request']['base']['repo']['full_name'] =<br>
payload['pull_request']['base']['repo']['name']<br>
        return super(CustomGitHubEventHandler,<br>
self).handle_pull_request(payload, event)<br>
<br>
On Tue, Jan 23, 2018 at 11:46 AM, David Alves <<a href="mailto:davidralves@gmail.com" target="_blank">davidralves@gmail.com</a>> wrote:<br>
> Hi<br>
><br>
>   I've installed the latest buildbot (with the travis shim) and got it<br>
> to mostly work with a private project hosted on github.<br>
>   I can trigger builds manually (force build)<br>
>   I setup github/buildbot so that the apps can cross post, and fetch.<br>
> I've tested that github can post to bb's webhook, that bb can fetch a<br>
> commit. I haven't seen bb post messages to the pull request.<br>
>   Tailing the log shows that bb is notified when a pull request is<br>
> added/updated. No errors are shown.<br>
>   However this doesn't cause a "try" build to start or a build status<br>
> to be posted to the pull request. I do see the changes posted to<br>
>   Build>Last Changes.<br>
>   Any help would be greatly appreciated.<br>
><br>
>   Here's a redacted version of my cfg.yml:<br>
><br>
> env: {}<br>
> not_important_files: []<br>
> projects:<br>
> -   branches:<br>
>     - master<br>
>     github_token: <token><br>
>     name: <proj name><br>
>     reporter_context: bb%(prop:TESTS:+/)s%(prop:TESTS)s<br>
>     repository: <a href="mailto:git@github.com" target="_blank">git@github.com</a>:<org>/<proj name>.git<br>
>     shallow: 100<br>
>     retryFetch: true<br>
>     mode: "full"<br>
>     method: "clobber"<br>
>     stages: []<br>
>     tags: []<br>
>     vcs_type: github<br>
>     treeStableTimer: 1<br>
> stages: []<br>
> workers:<br>
> -   id: <id><br>
>     name: local-worker<br>
>     number: 5<br>
>     type: LocalWorker<br>
><br>
>   and the master.cfg:<br>
><br>
> from buildbot_travis import TravisConfigurator<br>
> c = BuildmasterConfig = {}<br>
> TravisConfigurator(BuildmasterConfig, basedir).fromYaml('cfg.yml')<br>
><br>
> from buildbot_travis import TravisConfigurator<br>
> from buildbot_travis.configurator import TravisEndpointMatcher<br>
> from buildbot.plugins import util<br>
><br>
> c['db_url'] = “<conn str>”<br>
> c['buildbotNetUsageData'] = None<br>
> c['buildbotURL'] = “<local url>”<br>
><br>
> c['www']['authz'] = util.Authz(<br>
>             allowRules = [<br>
>                util.AnyEndpointMatcher(role="admins", defaultDeny=True),<br>
>                util.AnyControlEndpointMatcher(role="admins"),<br>
>             ],<br>
>             roleMatchers = [<br>
>                util.RolesFromGroups(groupPrefix=‘<org name>/‘),<br>
>             ]<br>
>     )<br>
> c['www']['auth'] = util.GitHubAuth(“<client id>”, “<client secret>”,<br>
> apiVersion=4, getTeamsMembership=True)<br>
><br>
> # GitHub webhook receiver<br>
> c['www']['change_hook_dialects'] = {<br>
>         'github': {<br>
>                 'token': ‘<token>’,<br>
>                 'secret': ‘<secret>’,<br>
>                 'strict': True,<br>
>         }<br>
> }<br>
><br>
> Best<br>
> David<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@buildbot.net" target="_blank">users@buildbot.net</a><br>
<a href="https://lists.buildbot.net/mailman/listinfo/users" rel="noreferrer" target="_blank">https://lists.buildbot.net/mailman/listinfo/users</a></blockquote></div>