127 lines
4.0 KiB
YAML
127 lines
4.0 KiB
YAML
# 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/yaml
|
|
|
|
name: 'LCU.API.Internal.MemberPreferencesApi.$(Build.SourceBranchName).$(Date:yyyyMMdd)$(Rev:.r)'
|
|
trigger:
|
|
branches:
|
|
include:
|
|
- '*'
|
|
|
|
variables:
|
|
- template: ./config-files/qa-pvars.yaml
|
|
- name: docker_container_repository_name
|
|
value: landmarkcu/member-preferences-api
|
|
- name: buildConfiguration
|
|
value: Release
|
|
|
|
resources:
|
|
repositories:
|
|
- repository: azdo_pipeline_templates
|
|
type: git
|
|
name: Infrastructure Platform/azdo-pipeline-templates
|
|
ref: main
|
|
|
|
stages:
|
|
- template: docker-build-push.yaml@azdo_pipeline_templates
|
|
parameters:
|
|
azdo_agent_pool: $(pvar_azdo_agent_pool)
|
|
docker_registry_service_connection: $(pvar_docker_registry_service_connection)
|
|
docker_container_repository_name: $(docker_container_repository_name)
|
|
dockerfile_path: ./Dockerfile
|
|
docker_image_tags: |
|
|
$(Build.BuildId)
|
|
latest
|
|
|
|
- stage: Build_and_publish_dacpac
|
|
displayName: Build and Publish Nuget Dacpac
|
|
pool:
|
|
name: LCUOnPrem
|
|
demands:
|
|
- SqlPackage
|
|
- MSBuild
|
|
|
|
jobs:
|
|
- job: Build
|
|
displayName: Build
|
|
steps:
|
|
- task: DotNetCoreCLI@2
|
|
inputs:
|
|
command: 'restore'
|
|
feedsToUse: 'select'
|
|
vstsFeed: '58ebbac4-8e98-4281-bb3f-58003852f4a7'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
inputs:
|
|
command: 'build'
|
|
projects: '**/*.csproj'
|
|
arguments: '--configuration $(buildConfiguration)'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Test
|
|
inputs:
|
|
command: test
|
|
projects: '**/*Tests.csproj'
|
|
arguments: '--configuration $(BuildConfiguration) --collect "Code coverage"'
|
|
|
|
- task: MSBuild@1
|
|
displayName: Build sql project
|
|
inputs:
|
|
solution: './LCU.API.Internal.MemberPreferencesApiSql/LCU.API.Internal.MemberPreferencesApiSql.sqlproj'
|
|
configuration: 'Release'
|
|
|
|
- task: CopyFiles@2
|
|
displayName: Copy dacpac to artifact staging directory
|
|
inputs:
|
|
SourceFolder: './LCU.API.Internal.MemberPreferencesApiSql/bin/$(BuildConfiguration)/'
|
|
Contents: 'LCU.API.Internal.MemberPreferencesApiSql.dacpac'
|
|
TargetFolder: '$(build.artifactstagingdirectory)'
|
|
OverWrite: true
|
|
|
|
- task: NuGetCommand@2
|
|
condition: and (succeeded(), eq(variables['Build.SourceBranchName'], 'main') )
|
|
displayName: 'NuGet Push'
|
|
inputs:
|
|
command: 'push'
|
|
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg'
|
|
publishVstsFeed: '58ebbac4-8e98-4281-bb3f-58003852f4a7'
|
|
allowPackageConflicts: true
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
condition: and (succeeded(), or( eq(variables['Build.SourceBranchName'], 'develop'), eq(variables['Build.SourceBranchName'], 'main')) )
|
|
displayName: 'Publish Artifact: dist'
|
|
inputs:
|
|
PathtoPublish: '$(build.artifactstagingdirectory)'
|
|
ArtifactName: 'dist'
|
|
|
|
- task: NuGetCommand@2
|
|
condition: and (succeeded(), eq(variables['Build.SourceBranchName'], 'main') )
|
|
displayName: 'NuGet Push'
|
|
inputs:
|
|
command: 'push'
|
|
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg'
|
|
publishVstsFeed: '58ebbac4-8e98-4281-bb3f-58003852f4a7'
|
|
allowPackageConflicts: true
|
|
|
|
|
|
- stage: Publish
|
|
displayName: Publish
|
|
dependsOn: Build_and_publish_dacpac
|
|
condition: or(eq(variables['Build.SourceBranchName'], 'develop'), eq(variables['Build.SourceBranchName'], 'main'))
|
|
jobs:
|
|
- job: Publish
|
|
displayName: Publish
|
|
steps:
|
|
- task: CmdLine@2
|
|
inputs:
|
|
script: 'sed -i ''s/{{version}}/$(Build.BuildID)/g'' _deploy/base/Deployment.yaml'
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
inputs:
|
|
targetPath: './_deploy'
|
|
artifact: 'overlay'
|
|
publishLocation: 'pipeline'
|
|
displayName: 'Publish Overlay Artifact'
|
|
|