Problem Triggering Binder Build through API endpoint

In pyhf we have tutorials in Binder. As part of our CI when we merge a PR into master we try to trigger a Binder build on master by basically curling the build API endpoint so that a user never has to wait for Binder to build. This has worked well for a long time and I’ve added this functionality to other projects as well.

However, it seems that between May 24th, 2019 and June 21st, 2019 this seems to have stopped working. It seems that this is because when the url https://mybinder.org/build/gh/diana-hep/pyhf/master gets resolved it redirects to https://gke.mybinder.org/build/gh/diana-hep/pyhf/master. I’m not sure, but given a search on “gke” in the Discourse it seems that GKE is one of the deployments of BinderHub in the Binder Federation (please correct me if I’m wrong).

My question is how can I know what endpoint will actually get resolved so that our trigger_binder.sh script can actually wait long enough to trigger the build?

You can’t know as there are several hubs that back mybinder.org now. So even if you know the list of currently active hosts, in 2minutes from now one of them might have been taken down.

The right thing to do is to follow the redirect that you get sent on (or is it to?) when you visit the build endpoint. I think curl -L will do that for you.

1 Like

I think curl -L will do that for you

After a coffee I came to the same conclusion and was just coming back to close this topic. Thanks for following up on this though, Tim, even though this should have never been an issue. My bad!

2 Likes

I’m now realizing that there is no guarantee (obviously) that the cluster that a build is triggered on is the same cluster that a user will be directed to when they launch the Binder. As a result, both the GKE and OVH clusters should be triggered when a PR is merged to ensure a built Binder for the end user. (example in pyhf)