Deploy an App Service (Web App) with GitLab

App Service comes with Deployment Source which we can deploy our source code from many repository such as Github, Bitbucket or Dropbox. But there's no built-in support for GitLab. If we chose to use External Repository option, it'll support only for the public repository. So this will guide the steps we should take inorder to make our Web App (or any App Service) in Microsoft Azure connect to our private GitLab repository.

Set up a Local Git Repository

We need to setup a local git repository as a Deployment Source to our App Service inorder to use GitLab.

  1. Select a Local Git Repository as a Deployment Source.
    Local Git Repository Option
  2. Looking for a Deployment Trigger URL and copy it for later use. The hook URL is the /deploy path on the Kudu service. So it looks like https://$user:[email protected]/deploy.
    Deployment Trigger URL
  3. Take the full deploy URL above, and replace /deploy with /api/sshkey?ensurePublicKey=1. So it'll look like https://$mysite:[email protected]/api/sshkey?ensurePublicKey=1.

Set up an SSH deploy key

  1. Use the URL above to make a web request, may put into the Chrome Web Browser's address bar, which returns an SSH public key.
  2. From your GitLab repository select the menu Deploy Keys.
    Deploy Keys Menu
  3. Set this string as a 'deploy key' on your GitLab repository.
    Add Deploy Keys

Set up a Web Hook

Set up a Web Hook so Kudu gets notified when a deployment happens.

  1. Use the Deployment Trigger URL above to add as a Web Hook in GitLab repository.
  2. Select the menu Webhooks.
    Webhooks Menu
  3. Set this URL to the GitLab.
    Add Webhooks

Setting up an URL to GitLab repository

This part will guide to to set up continuous deployment using Resource Explorer

  1. Go to https://resources.azure.com/
  2. Find your site, either using the search UI or by expand the tree
  3. Under the site, open up the sourcecontrols/web node in the tree.
    Navigate to the site in Resource Explorer
  4. Click on the Edit button (you may need to first set Explorer to Read/Write mode)
  5. Set the repoUrl property to your repo, e.g.
      "repoUrl": "https://github.com/davidebbo-test/Hello_World_Demo",
    
  6. (optional) if you want to use a non-default branch, set the "branch" property as well
  7. Click the PUT button to apply the change.
    Change the reopUrl
  8. You're done! Now if you go to the portal, you should see that the site is hooked up, and the initial commit will get deployed

It might have some error when you PUT the repoURL in Resource Explorer, it's OK, let it be!

results matching ""

    No results matching ""