Here’s my intended use case:
- Create a GitHub repository via the GitHub API
- Wait 30 seconds (retry in 5 minutes if the next step fails)
- Enable drone builds: POST /api/repos/github_org/repo_name
- Change the build settings: PATCH gated:true, trusted:true, private:true
The user that creates the repositories is an owner in the organization
and all of the drone API calls are made with this user’s token.
I always get the following results:
time="2017-09-20T08:31:01Z" level=debug msg="Cannot find repository myorg/myrepo. sql: no rows in result set" time="2017-09-20T08:31:01Z" level=info ip=172.17.0.1 latency=3.432468ms method=POST path="/api/repos/myorg/myrepo" status=404 time="2017-09-20T08:31:01Z" user-agent=
I tried forcing a sync by calling
/api/user/repos?all=true&flush=true before the POST request but that didn’t work. However, if I’m logged in with another account and I force sync through the web UI then it does work. Could be OAuth related?