How to trigger manually container refresh

女生的网名这么多〃 提交于 2019-12-13 18:23:41

问题


I am using WebApp for Container in Azure, currently I build my own containers in Jenkins and push it to my own private registry.

My Own private registry is very basic and doesn't have functionality for WebHook, so I would like to add in my Jenkins workflow to trigger the container refresh.

I have followed these steps: https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-ci-cd and I got the URL but when I try to curl to it I got:

401 - Unauthorized: Access is denied due to invalid credentials. if I do a GET request like:

curl https://$user:password@mysite.scm.azurewebsites.net/docker/hook

and

HTTP Error 411. The request must be chunked or have a content length. if I do a POST request

curl -X POST curl https://$user:password@mysite.scm.azurewebsites.net/docker/hook

How I should do the request with Curl to trigger this?

Thanks,


回答1:


Solution:

Simple as:

curl -X POST 'curl https://$user:password@mysite.scm.azurewebsites.net/docker/hook' -H '' -d ''




回答2:


Don't forget to escape the dollar sign at the beginning of the username.

So, for example:

curl https://\$user:password@mysite.scm.azurewebsites.net/docker/hook'



回答3:


First of all

curl -X POST curl https://$user:password@mysite.scm.azurewebsites.net/docker/hook

The first error here is on $user. When you start a word with $ your terminal will think that it's an environment variable. So for your terminal considerer as a string, you have to put a \ before the $.

Now we have this

curl -X POST curl https://\$user:password@mysite.scm.azurewebsites.net/docker/hook

The second error is because there are some special characters in this url. So you have to put between quotes.

Now, we have this

curl -X POST curl "https://\$user:password@mysite.scm.azurewebsites.net/docker/hook"

Finishing we have to add the parameters -H and -d at the end of the command.

Now the command

curl -X POST curl "https://\$user:password@mysite.scm.azurewebsites.net/docker/hook" -d -H

should work.



来源:https://stackoverflow.com/questions/46766903/how-to-trigger-manually-container-refresh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!