GitLab Continuous Deployment to Azure Web App

徘徊边缘 提交于 2019-12-08 04:13:06

问题


I want to be able to use Continuous deployment to an Azure webapp deployment slot from a GitLab repo.. Specifying the branch so i can have a staging and develop slot for these respective git repo branches.

Using the two links below i managed to configure my website to use continuous deployment on one of my deployment slots.

https://forum.gitlab.com/t/is-there-true-gitlab-azure-continuous-deployment/2162/4

https://github.com/projectkudu/kudu/wiki/Continuous-deployment

However since this is a hack to get around there being a lack of a GitLab provider, It doesn't appear to be possible to specify the branch.

The gitlab-azure integration seems to be

  1. User commits to the GitLab repo
  2. This Triggers a GitLab webhook which posts some data to kudu on the azure webapp endpoint.
  3. Kudu accesses the gitlab repo using the details in the webhookpost and the credentials it uses are from the Gitlab DeployKey.

This implies that gitlab needs to provide the branch details, in the webhook post.

I did try to edit the branch value via https://resources.azure.com/

in https://resources.azure.com/subscriptions/<MYSUBSCRIPTIONGUID>/resourceGroups/<MYRESOURCEGROUPNAME>/providers/Microsoft.Web/sites/<MYSITE>/slots/<MYSLOT>/sourcecontrols/web

However changing any value in this node and saving fails as it seems the Gitlab workaround allows entry of an repoUrl which fails the parsing.

I created an issue in the Kudu repo (https://github.com/projectkudu/kudu/issues/1960) but it seems fixing this is something needed on the Gitlab side. However I've not had any response to my raised issue. https://gitlab.com/gitlab-org/gitlab-ee/issues/455


回答1:


You can do this by setting an AppSetting called deployment_branch on your Azure Web App.

Note that Azure does not rely on the WebHook payload to know what branch to deploy. So if you push to a different branch, it'll still try pulling from the branch it's been configured to use, and end up doing nothing since it's up to date. This is true even if you use GitHub instead of GitLab.



来源:https://stackoverflow.com/questions/36915380/gitlab-continuous-deployment-to-azure-web-app

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