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?
Sorry, I am currently unable to repeat any issues with synchronization. I just created a new repository and then went into the user interface and clicked the “synchronize” button at which point it was visible in the repositories list.
Yes, the user interface uses the API. This means that any functions available to the user interface can be invoked directly using your personal account token.
So then the only difference is which user was making the API calls (my own account or the bot account that failed). As I said, the user that failed to synchronize is also an owner in the organization so I don’t see what could’ve gone wrong.
Is there some kind of periodic background sync that I could wait for?
I’ll also try a clean install tomorrow.
use the chrome developer tools network inspector to see how the API call is being invoked, and make sure you are invoking it correctly (correct path, method, etc)
check the database to see if the repository was added. `select * from repos where repo_full_name=‘foo/bar’
synchronize your personal account as well. It is not enough to synchronize with a bot because drone still needs to synchronize your account and synchronize your individual repository permissions.
Is there some kind of periodic background sync that I could wait for?
there is no background sync. When the user requests the repository list (via the UI or API) it will automatically synchronize if the previous sync was more than 72 hours ago.
The appeal of drone for us is the simple API. So I think when there is a POST request for a missing repository, drone should take care of synchronization automatically and not fail with a 404 response. For now, I solved this with multiple delayed retries - calling the refresh API endpoint each time before the POST request.
Also GitHub seems to have organization web hooks. Can’t we utilize that?
I can’t promise anything but I may be able to allocate some time to contribute work on this.
Organization wide repository settings would be pretty cool.
docker run -d -v /some/local/config:/config bketelsen/captainhook
The reason this is preferred (at this time) to enabling organization webhooks in drone core is that we would need to assess all providers (gitlab, gitea, gogs, bitbucket, stash, coding) and implement the functionality across the board, if available.
I am stuck with similar kind of issue.
Could you let me know how much delay did you add and exactly which API did you hit to synchronize the repos in drone
I am struggling to sync repos via the Drone API in order to setup Drone programmatically for the first time. Basically, I am using Ansible to setup Drone and when I run the Drone Docker image, I use this in order to create a user:
DRONE_USER_CREATE=username:coltenkrauter,machine:false,admin:true,token:4123a6c5986aeb0839b18a03ee3f6be1 (Don’t worry, this is a fake token)
Anyway, when I have Ansible try to sync repos with the following,
I simply get an internal server error 500 with message {“message”: “Bad credentials”}
But I don’t understand why I am getting a bad credentials error… This only happens when I try this particular POST… if I do a get on the same endpoint, it works fine… except it isn’t synched so I don’t get any GitHub repos back in the list.
the reason is because the system cannot make any API calls to github on your behalf until you have logged-in and authorized access, which generates a github access token. Note that the token provided in DRONE_USER_CREATE is a drone API token, and not a github access token.