DevOps

Prev Next

To make a smoother setup experience in Azure DevOps, XLENT Link has provided templates for continuous integration and deploy in the repository nexus-azure-devops-tools. We will refer to it below when we use it's pipeline templates.

Setup connections

  1. Go into your PoCproject in Azure Devops.
  2. Go to Project settings
  3. Go to Pipeline ->Service connections

GitHub connection

Create a new service connection to GitHub named github-nla-acme-nexus (We will grant it from the user nla-acme, therefore we add nla to the name)

  1. Allow all pipelines to use this connection.
  2. Grant access for Azure Pipelines to access your GitHub organization
  3. Select the BusinessApi.Librariesrepository.
  4. Approve and install Azure Pipelines for the BusinessApi.Libraries and developer-toolsrepository
  5. Go into Policies and allow all pipelines to use this connection.

Azure connection

Create a new service connection to Azure Classicnamed azure-acme-nexus

  1. Select Certificate Based
  2. Click on publish settings file
  3. Select your subscription, validate
  4. Download
  5. Use the file to fill in the form, verify connection

Create a new service connection to Azure Resource Managernamed azure-acme-nexus

  1. Select your subscription and resource group
  2. If they don't appear, try this:
    1. Use full version (bottom of form)
    2. Add the subscription id and name
    3. Go back to the automated version
    4. Select the poc resource group
    5. If it fails; close and try again
  3. Click on publish settings file
  4. Select your subscription, validate
  5. Download
  6. Use the file to fill in the form, verify connection

NuGet feed

When you want to download the NuGets you need the URL of the NuGet Feed and when you want to push NuGets to the feed you need the Feed name.

  1. Go to your azure devops project, typically https://dev.azure.com/AcmeNexus/PoC
  2. Go to Artifacts
  3. Note the name of the feed that you want to use, this is the feed name to use later. Typically AcmeNexus
  4. Select the feed
  5. Go into Connect to feed
  6. Select the Package source URL, this is the URL you will use later

Business API

  1. Create a new Build pipeline
  2. Code: GitHub
  3. Select the BusinessApi repository
  4. Grant access for Azure Pipelines to access the repository
  5. Use ASP.NET Corefor configuration. NOT ASP.NET Core (.NET Framework)
  6. Copy the yml text below into the azure-pipelines.yml
  7. Run (don't worry if it fails)
  8. Go into the repo
  9. Move the azure-pipelines.yml file into the business api project folder.
  10. Commit and push
  11. Edit the pipeline
    1. Go into Trigger settings
    2. Change the name to BusinessApi
    3. Go into YML settings
    4. Change the yml file location to where you moved the yml file.
    5. Save and queue (this time it should not fail)
resources:
  repositories:
  - repository: azure-devops-tools
    type: github
    endpoint: 'github-nla-acme-nexus'
    name: 'nexus-link/nexus-azure-devops-tools'
    ref: 'refs/heads/master'

trigger:
  branches:
    include:
    - master
  paths:
    include:
    - 'src/Acme.BusinessApi.Service/*'

jobs:
- template: 'templates/netcore/v1/jobs/webapp.yml@azure-devops-tools'
  parameters:
    testProjectsPath: ''
    appProjectsPath: '**/src/Acme.BusinessApi.Service/**/*.csproj'
    buildConfiguration: 'Debug'
    azureSubscription: 'azure-acme-nexus'
    webAppName: 'poc-business-api-acme-nexus'
    appSettings: '-ClientId $(ClientId) -ClientSecret $(ClientSecret) -Stackify.Key $(Stackify.Key)'

Nugets CI/CD

Give Azure DevOps access to your GitHub repository.

Time to make build pipelines for all your nuget packages. First we make one template that we can reuse.

  1. Create a new Build pipeline.
  2. The code is on GitHub
  3. Select the BusinessApirepo
  4. If asked for: Use ASP.NET Corefor configuration.
  5. Copy the yml text below into the azure-pipelines.yml (change acme to your organization name)
  6. Run (don't worry if it fails)
  7. Go into the repo
  8. Move the newly created yml file into the src/Acme.BusinessApi.Libraries.Contractsfolder.
  9. Commit and push
  10. Edit the pipeline
    1. Go into Trigger settings
    2. Change the name to BusinessApi.Libraries.Contracts
    3. Go into YML settings
    4. Change the yml file location to where you moved the yml file.
    5. Save and queue (this time it should not fail)
  11. Done. Now we can clone this and use it for the other NuGets.
resources:
  repositories:
  - repository: azure-devops-tools
    type: github
    endpoint: 'github-nla-acme-nexus'
    name: 'nexus-link/nexus-azure-devops-tools'
    ref: 'refs/heads/master'

trigger:
  branches:
    include:
    - master
  paths:
    include:
    - 'src/Acme.BusinessApi.Libraries.Contracts/*'

jobs:
- template: 'templates/netcore/v1/jobs/nuget.yml@azure-devops-tools'
  parameters:
    nugetProjectsPath: 'src/Acme.BusinessApi.Libraries.Contracts/*.csproj'
    testProjectsPath: 'test/Contracts.Test/*.csproj'
    publishVstsFeed: '{your feed name}'

Clone for the other Nugets (Controllers and Sdk):

  1. Go to the BusinessApirepo.
  2. Copy the yml file from the Contracts library to the next nuget folder and update the yml file with the correct paths.
  3. Go to the BusinessApi.Libraries.Contracts Build pipeline
  4. Clone it
    1. Rename it
    2. Update the YAML file path
    3. Save and queue, Save and run

Azure Function apps CI/CD

  1. Create a new Build pipeline
  2. Code: GitHub
  3. Select the Nexus.FunctionApps repository
  4. Grant access for Azure Pipelines to access the repository
  5. If asked for: Use ASP.NET Corefor configuration.
  6. Copy the yml text below into the azure-pipelines.yml
  7. Run (don't worry if it fails)
  8. Edit the pipeline
    1. Go into Triggers
    2. Click on YAML
    3. Change the name to Nexus.FunctionApps
    4. Save and queue (this time it should not fail)
resources:
  repositories:
  - repository: azure-devops-tools
    type: github
    endpoint: 'github-nla-acme-nexus'
    name: 'nexus-link/nexus-azure-devops-tools'
    ref: 'refs/heads/master'

trigger:
  branches:
    include:
    - master

jobs:
- template: 'templates/netcore/v1/jobs/functionapp.yml@azure-devops-tools'
  parameters:
    appProjectsPath: 'Nexus.Functions/*.csproj'
    testProjectsPath: ''
    azureSubscription: 'azure-acme-nexus'
    webAppName: 'poc-function-app-acme-nexus'
    appSettings: '-Stackify.ApiKey $(Stackify.ApiKey) -AsyncCallerApp.PostUrl $(AsyncCallerApp.PostUrl) -Authentication.ClientId $(Authentication.ClientId) -Authentication.ClientSecret $(Authentication.ClientSecret) -Authentication.Url $(Authentication.Url)'