Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger manually container refresh

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://learn.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:[email protected]/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:[email protected]/docker/hook

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

Thanks,

like image 989
Dani Lou Avatar asked Oct 16 '17 09:10

Dani Lou


3 Answers

Solution:

Simple as:

curl -X POST 'curl https://$user:[email protected]/docker/hook' -H '' -d ''

like image 157
Dani Lou Avatar answered Nov 09 '22 08:11

Dani Lou


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

So, for example:

curl https://\$user:[email protected]/docker/hook'
like image 3
Donald Morton Avatar answered Nov 09 '22 08:11

Donald Morton


First of all

curl -X POST curl https://$user:[email protected]/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:[email protected]/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:[email protected]/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:[email protected]/docker/hook" -d -H

should work.

like image 2
Naian Barros Avatar answered Nov 09 '22 07:11

Naian Barros