How do I contact the Docker Hub before Jenkins via a web hook?

There seem to be many examples of polling GitHub, but how can I poll the Docker Hub and run a build based on this?

I have a webhook configured in the Docker Hub for my automatic build, but I don't see how to poll it in Jenkins.

This Jenkins plugin seems to be: https://wiki.jenkins-ci.org/display/JENKINS/DockerHub+Plugin

But, as I understand it, the plugin has been corrupted since changing the API on the Docker Hub.

Update:

It seems that the answer is to use the Trigger Builds Remote option removed in Build Triggers, however it does not work due to anonymity that does not have build permission. Then I switched to this plugin: https://wiki.jenkins-ci.org/display/JENKINS/Build+Token+Root+Plugin

So the URL becomes something like this: https://jenkinsserver.com/buildByToken/build?job=test&token=test

This works if I send POST to this URL through a browser (even incognito), but not with cURL. I get:

$ curl -X POST https://jenkinsserver.com/buildByToken/build?job=test&token=test <html><head><meta http-equiv='refresh' content='1;url=/securityRealm/commenceLogin?from=%2FbuildByToken%2Fbuild%3Fjob%3Dtest'/><script>window.location.replace('/securityRealm/commenceLogin?from=%2FbuildByToken%2Fbuild%3Fjob%3Dtest');</script></head><body style='background-color:white; color:white;'> Authentication required <!-- You are authenticated as: anonymous Groups that you are in: Permission you need to have (but didn't): hudson.model.Hudson.Read ... which is implied by: hudson.security.Permission.GenericRead ... which is implied by: hudson.model.Hudson.Administer --> </body></html> 

However, I can get it to work through cURL if I do this:

 curl -X POST https://user: token@jenkinsserver.com /buildByToken/build?job=test&token=test 

But, the Docker Hub does not like this URL ... enter image description here

What am I missing here? Am I even on the right track? If you are someone who runs a Jenkins task from the Docker Hub website, how do you do it?

+6
source share
1 answer

Author’s words: development in this plugin is really inactive, but can be resurrected at any time, especially with a specific use case. I created this plugin as PoC when the DockerHub hook was declared, but has no specific use to experiment further. Feel free to contribute so that the plugin can support your own use.

0
source

Source: https://habr.com/ru/post/980895/


All Articles