Ok so in Azure I tried to set my Continuous Deployment to point to my private gitlab repo but not sure of how to properly authenticate. Would be nice if it was built into the Azure portal like Github is. Are there detailed instructions anywhere? The instructions here, https://github.com/projectkudu/kudu/wiki/Continuous-deployment, are specific to GitHub.
The instructions on that page should work for GitLab (they mention GitLab on the page)
It’s the in the manual steps https://github.com/projectkudu/kudu/wiki/Continuous-deployment#setting-up-continuous-deployment-using-manual-steps
As they mention you will want to set it up using a GitLab deploy key. The GitLab docs talk about deploy keys a little bit: http://doc.gitlab.com/ce/ssh/README.html
They also need you to setup a webhook in GitLab to trigger azure. WebHooks are documented here: http://doc.gitlab.com/ce/web_hooks/web_hooks.html
Yeah I created an ssh key and am trying the instructions but I think it’s out dated. I feel like some of it isn’t accurate anymore.
Take the full deploy URL above, and replace /deploy with /api/sshkey?ensurePublicKey=1. So it’ll look like https://$mysite:BigRandomPassword@mysite.scm.azurewebsites.net/api/sshkey?ensurePublicKey=1
that url (my version of it obviously) returns a Hook execution failed: No route registered for ‘/api/sshkey?ensurePublicKey=1’
and “The easiest way to get this URL is to directly copy it from the Azure Portal. You’ll find it in the Configure tab, in the Deployment Trigger Url field.” which is maybe based on the old portal, though it seems pretty clear and self-explanatory.
So I think it’s the proper hook url I can’t determine yet.
I think the /deploy url is still the one you want to call from the hook. the /api/sshkey was for getting your public key from azure. which you would set as the deploy key in GitLab for that project.
Man I feel so close, if I use /deploy though I get an empty error on gitlab “Hook execution failed:”
I followed these directions; I obtained a key from my azure website using the kudu url, and pasted it into the project settings as a deploy key. However, the CD service on Azure is unable to clone the repository.
Alright - I think I figured out my problem. It must have just been a copy-paste problem, because when I double-checked the SSH key fingerprints as shown on GitLab and what
ssh-keygen -lf shows, they didn’t match (GitLab showed the wrong fingerprint). I did the copy/paste again into a new deploy key and checked the fingerprints to show it matched, and then it worked. Now I have to go do the same thing for submodules, but I think I’m set now.
Ive managed to get the above working, how do i do this with a branch? If i try and add this to the sourcecontrols\web\properties\branch setting i get a BadRequest which seems to be related to the repoUrl parameter rather than the branch parameter
Deploy from gitlab
Deploy and sync
You must download the slot “Publish profile” which is available under “Overview” to get the username and password for the web hook on gitlab. The username is normally the one you setup under “Deployment credentials”.
Careful to remove to prefix of the project from the user. ie myproject$myusername becomes $myusername.
You will use as address the Kudo address plus /deploy.
Custom PHP configuration
So I had moved on to something else and dropped this task. 1.5 years later I’m at it again and searching Google and found my original question lol. Totally forgot about this post. But this recent post looks like what I’m looking for. I’ll try it out.
I followed all the steps provided here. I am able to see the webhook from GitLab triggering the Kudu.
However, Kudu is not able to download the repository. I am receiving the below exception
ssh: connect to host hostname.com port 22: Connection timed out\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\r\nD:\Program Files (x86)\Git\cmd\git.exe fetch origin --progress
by the way I am using private Gitlab CE.
Did you manage to solve this problem?