singularityhub / singularityhub.github.io

Container tools for scientific computing! Docs at https://singularityhub.github.io/singularityhub-docs
https://singularityhub.github.io
68 stars 9 forks source link

Triggering manual builds with a webhook #84

Closed eriknstevenson closed 7 years ago

eriknstevenson commented 7 years ago

Hi,

I am maintaining a docker image and a singularity image which is based on said docker image. I want to automate the building of both images. Since the singularity image depends on the docker image, I would like to have the singularity build wait until the docker build is complete and on dockerhub.

Dockerhub provides a way to call webhooks after a new image is pushed, and I wonder if there is some way I can use this to trigger a build on singularity hub?

If not, is there some other way that I might achieve what I'm after?

Thanks!

vsoch commented 7 years ago

Hey @narrative ! I think you would want to try out the deployment webhook that is offered. https://developer.github.com/v3/guides/delivering-deployments/ It would mean that you would do the build / testing with Continuous Integration, deploy your image (to Docker Hub) and that would send a webhook to Singularity Hub, that is able to detect a deployment webhook (and ignore others). If you want a command line, authenticated push, Singularity Hub proper won't be offering that to users, but it is possible if you serve your own Registry --> https://singularityhub.github.io/sregistry.

We haven't had any users test this yet, so if you'd like to be the first and help out with looking into issues, it would be fantastic! Let me know your thoughts.

eriknstevenson commented 7 years ago

Thanks @vsoch, I think I understand what you are suggesting. How can I determine the singularity hub URL that I should direct the Dockerhub webhook to? Is it simply the URL of the collection?

From looking at dockerhub's webhook info I am unsure if this will be treated by singularity hub as a deployment webhook as the payload seems to be considerably different from GitHub's.

I guess I can direct the Dockerhub webhook at a little server of my own, which then triggers the Github deploy via the API. Is that what you were getting at?

vsoch commented 7 years ago

The hook wouldn't come from Dockerhub, it would come from Github when it gets a deployment success status from your continuous integration service. Docker webhooks aren't secure/certified with a secret so unfortunately cannot be accepted as a hook.

eriknstevenson commented 7 years ago

I understand. Thanks again!