Untitled

 avatar
unknown
plain_text
a year ago
3.4 kB
9
Indexable
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yam1
trigger: 
  - none

variables:
  pipelineImageName: 'ubuntu-latest'
  serviceConnectionName: 'Workflow-DevTest'
  infrastructureSourcesFolderPath: 'Infrastructure'
  infrastructureTemplateFilePath: '$(infrastructureSourcesFolderPath)/TODO'
  infrastructureTemplateParametersFilePath: '$(infrastructureSourcesFolderPath)/TODO'
  subscriptionId: '1fedd5f0-38e0-48c7-9dca-f895752682a9'
  location: 'eastus2'
  resourceGroup: 'wf-cd-2'
  bkstrgrg: 'wf-cd-2'
  bkstrg: 'wfcd2storage'
  bkcontainer: 'wf-cd-2-stgcont'
  bkstrgkey: 'testpipeline.terraform.tfstate'
pool:
  vmImage: $(pipelineImageName)  # Specify the VM image at the pipeline level

stages:
- stage: DotnetBuildTestPublish
  jobs:
  - job: BuildTestPublish
    steps:
    - task: DotNetCoreCLI@2
      displayName: DotNet Restore
      continueOnError: false
      #condition: succeeded() # Runs only if the previous stages/jobs succeeded
      inputs:
        command: 'restore'
        projects: '**/*.csproj'
        feedsToUse: 'select'
    - task: DotNetCoreCLI@2
      displayName: DotNet Build
      condition: succeeded()
      # Runs only if DotNet Restore succeeded
      inputs:
        command: 'build'
        projects: '**/*.csproj'
        arguments: '--configuration $(buildConfiguration)'
    - task: DotNetCoreCLI@2
      displayName: DotNet Test
      condition: succeeded() # Runs only if DotNet Build succeeded
      inputs:
        command: 'test'
        projects: '**/*Tests.csproj'
        arguments: '--configuration $(buildConfiguration)'
    - task: DotNetCoreCLI@2
      displayName: DotNet Publish
      condition: succeeded() # Runs only if DotNet Test succeeded
      inputs:
        command: 'publish'
        publishWebProjects: true
        zipAfterPublish: true
        arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'

- stage: tfvalidate
  jobs:
  - job: validate
    continueOnError: false
    steps:
#    - task: TerraformInstaller@8
#      displayName: tfinstall
#      inputs:
#        terraformVersion: 'latest'
    - task: ms-devlabs.custom-terraform-tasks.custom-terraform-installer-task.TerraformInstaller@0
      displayName: tfinstall
      inputs:
        terraformVersion: 'latest'
    - task: TerraformTaskV4@4
      displayName: tfinit
      inputs:
        provider: 'azurerm'
        command: 'init'
        backendServiceArm: 'Workflow-DevTest'
        backendAzureRmResourceGroupName: 'wf-cd-2'
        backendAzureRmStorageAccountName: 'wfcd2storage'
        backendAzureRmContainerName: 'wf-cd-2-stgcont'
        backendAzureRmKey: 'testpipeline.terraform.tfstate'
        workingDirectory: '$(System.DefaultWorkingDirectory)/terraform'

    - task: TerraformTaskV3@3
      displayName: validate
      inputs:
        provider: 'azurerm'
        command: 'validate'
        workingDirectory: '$(System.DefaultWorkingDirectory)/terraform'
    - task: TerraformTaskV4@4
      displayName: plan
      inputs:
        provider: 'azurerm'
        command: 'plan'
        environmentServiceNameAzureRM: 'Workflow-DevTest'
        workingDirectory: '$(System.DefaultWorkingDirectory)/terraform'

Editor is loading...
Leave a Comment