Skip to content

Commit

Permalink
Convert classic to YAML
Browse files Browse the repository at this point in the history
  • Loading branch information
furqanagwan committed Jan 13, 2025
1 parent 5fa6496 commit f140619
Show file tree
Hide file tree
Showing 4 changed files with 316 additions and 101 deletions.
234 changes: 133 additions & 101 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,128 +1,160 @@
parameters:
- name: OverrideBlockOnPossibleDataLoss
displayName: Add /p:BlockOnPossibleDataLoss=false argument to DACPAC deployment
type: boolean
default: false

trigger:
batch: true
branches:
include:
- "master"

variables:
- group: BUILD Management Resources
- group: ESFA - SonarCloud
- name: buildConfiguration
value: 'release'
- name: buildPlatform
value: 'anycpu'
- name: SolutionBaseName
value: SFA.DAS.ApplyService
- name: BuildConfiguration
value: release
- name: BuildPlatform
value: any cpu
- group: RELEASE Management Resources
- group: RELEASE das-apply-service
- name: Deploy
value: $[or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.Reason'], 'Manual'), eq(variables['Build.Reason'], 'PullRequest'))]

resources:
repositories:
- repository: self
- repository: das-platform-building-blocks
type: github
name: SkillsFundingAgency/das-platform-building-blocks
ref: refs/tags/2.1.28
endpoint: SkillsFundingAgency
- repository: das-platform-automation
type: github
name: SkillsFundingAgency/das-platform-automation
ref: refs/tags/5.1.14
endpoint: SkillsFundingAgency
pipelines:
- pipeline: das-employer-config
project: Digital Apprenticeship Service
source: das-employer-config
branch: master

stages:
- stage: Build
jobs:
- job: 'CodeBuild'
pool:
name: DAS - Continuous Integration Agents
demands: LATEST_DOTNET_VERSION -equals 3.1
workspace:
clean: all
steps:
- template: azure-pipelines-templates/build/step/gitversion.yml@das-platform-building-blocks
- template: pipeline-templates/job/code-build.yml
parameters:
SolutionBaseName: $(SolutionBaseName)
BuildConfiguration: $(BuildConfiguration)
- template: azure-pipelines-templates/build/job/dacpac-template.yml@das-platform-building-blocks
parameters:
SolutionBaseName: $(SolutionBaseName).Database
SqlProjectPath: src/$(SolutionBaseName).Database/$(SolutionBaseName).Database.sqlproj

- template: azure-pipelines-templates/build/step/app-build.yml@das-platform-building-blocks
parameters:
SonarCloudProjectKey: SkillsFundingAgency_das-apply-service
ContinueOnVulnerablePackageScanError: true

- task: DotNetCoreCLI@2
displayName: 'dotnet pack'
inputs:
command: pack
packagesToPack: 'src/SFA.DAS.ApplyService.Types/SFA.DAS.ApplyService.Types.csproj'
versioningScheme: byBuildNumber
packDirectory: $(build.artifactstagingdirectory)/NugetPackages

- task: DotNetCoreCLI@2
displayName: 'Publish Website'
inputs:
command: publish
publishWebProjects: false
projects: 'src/SFA.DAS.ApplyService.Web/SFA.DAS.ApplyService.Web.csproj'
arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)/publish --no-restore --no-build'
- stage: Deploy_AT
dependsOn: Build
displayName: Deploy to AT
condition: and(succeeded(), eq(variables.Deploy, 'true'))
variables:
- group: DevTest Management Resources
- group: AT DevTest Shared Resources
- group: AT das-apply-service
jobs:
- template: pipeline-templates/job/deploy.yml
parameters:
Environment: AT
ServiceConnection: SFA-DAS-DevTest-ARM
OverrideBlockOnPossibleDataLoss: ${{ parameters.OverrideBlockOnPossibleDataLoss }}
AppRoleAssignmentsServiceConnection: das-app-role-assignments-CDS

- task: DotNetCoreCLI@2
displayName: 'Publish API'
inputs:
command: publish
publishWebProjects: false
projects: 'src/SFA.DAS.ApplyService.InternalApi/SFA.DAS.ApplyService.InternalApi.csproj'
arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)/publish --no-restore --no-build'
- stage: Deploy_TEST
dependsOn: Build
displayName: Deploy to TEST
variables:
- group: DevTest Management Resources
- group: TEST DevTest Shared Resources
- group: TEST das-apply-service
jobs:
- template: pipeline-templates/job/deploy.yml
parameters:
Environment: TEST
ServiceConnection: SFA-DAS-DevTest-ARM
OverrideBlockOnPossibleDataLoss: ${{ parameters.OverrideBlockOnPossibleDataLoss }}
AppRoleAssignmentsServiceConnection: das-app-role-assignments-CDS

- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
contents: |
azure/**
targetFolder: '$(build.artifactstagingdirectory)/publish'
- stage: Deploy_TEST2
dependsOn: Build
displayName: Deploy to TEST2
variables:
- group: DevTest Management Resources
- group: TEST2 DevTest Shared Resources
- group: TEST2 das-apply-service
jobs:
- template: pipeline-templates/job/deploy.yml
parameters:
Environment: TEST2
ServiceConnection: SFA-DAS-DevTest-ARM
OverrideBlockOnPossibleDataLoss: ${{ parameters.OverrideBlockOnPossibleDataLoss }}
AppRoleAssignmentsServiceConnection: das-app-role-assignments-CDS

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
pathtoPublish: '$(build.artifactstagingdirectory)/publish'
- stage: Deploy_DEMO
dependsOn: Build
displayName: Deploy to DEMO
variables:
- group: DevTest Management Resources
- group: DEMO DevTest Shared Resources
- group: DEMO das-apply-service
jobs:
- template: pipeline-templates/job/deploy.yml
parameters:
Environment: DEMO
ServiceConnection: SFA-DAS-DevTest-ARM
OverrideBlockOnPossibleDataLoss: ${{ parameters.OverrideBlockOnPossibleDataLoss }}
AppRoleAssignmentsServiceConnection: das-app-role-assignments-CDS

- publish: $(build.artifactstagingdirectory)/NugetPackages
artifact: NugetPackages
- stage: Deploy_PP
dependsOn: Build
displayName: Deploy to PP
variables:
- group: PreProd Management Resources
- group: PreProd Shared Resources
- group: PREPROD das-apply-service
jobs:
- template: pipeline-templates/job/deploy.yml
parameters:
Environment: PP
ServiceConnection: SFA-DIG-PreProd-ARM
OverrideBlockOnPossibleDataLoss: ${{ parameters.OverrideBlockOnPossibleDataLoss }}
AppRoleAssignmentsServiceConnection: das-app-role-assignments-FCS

- job: 'DACPACBuild'
pool:
vmImage: 'windows-2019'
workspace:
clean: all
steps:
- task: VSBuild@1
displayName: 'Build DACPAC'
inputs:
solution: 'src/SFA.DAS.ApplyService.Database/SFA.DAS.ApplyService.Database.sqlproj'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArgs: '/p:PackageLocation="$(build.artifactstagingdirectory)/publish"'
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
contents: |
src/**/*.dacpac
targetFolder: '$(build.artifactstagingdirectory)/publish'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
pathtoPublish: '$(build.artifactstagingdirectory)/publish'
- stage: Deploy_MO
dependsOn: Build
displayName: Deploy to MO
variables:
- group: MO Management Resources
- group: MO Shared Resources
- group: MO das-apply-service
jobs:
- template: pipeline-templates/job/deploy.yml
parameters:
Environment: MO
ServiceConnection: SFA-ASM-ModelOffice-ARM
OverrideBlockOnPossibleDataLoss: ${{ parameters.OverrideBlockOnPossibleDataLoss }}
AppRoleAssignmentsServiceConnection: das-app-role-assignments-FCS

- stage: NugetPublish
displayName: 'Publish Nuget Package'
pool:
name: 'DAS - Continuous Deployment Agents'
condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'))
- stage: Deploy_PROD
dependsOn: Build
displayName: Deploy to PROD
variables:
- group: Prod Management Resources
- group: Prod Shared Resources
- group: PROD das-apply-service
jobs:
- job: 'CleanArtifacts'
displayName: Clean artifacts directory
workspace:
clean: all
- deployment: 'NugetPush'
dependsOn: 'CleanArtifacts'
environment: 'Nuget'
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: NugetPackages
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
packagesToPush: '$(Pipeline.Workspace)/NugetPackages/*.nupkg;!$(Pipeline.Workspace)/NugetPackages/*.symbols.nupkg'
nuGetFeedType: external
publishFeedCredentials: 'SFA NuGet'
- template: pipeline-templates/job/deploy.yml
parameters:
Environment: PROD
ServiceConnection: SFA-DIG-Prod-ARM
OverrideBlockOnPossibleDataLoss: ${{ parameters.OverrideBlockOnPossibleDataLoss }}
AppRoleAssignmentsServiceConnection: das-app-role-assignments-FCS
56 changes: 56 additions & 0 deletions pipeline-templates/job/code-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
parameters:
SolutionBaseName:
BuildConfiguration:

jobs:
- job: CodeBuild
pool:
name: DAS - Continuous Integration Agents
workspace:
clean: all
variables:
- group: BUILD Management Resources
steps:
- template: azure-pipelines-templates/build/step/gitversion.yml@das-platform-building-blocks
- template: azure-pipelines-templates/build/step/app-build.yml@das-platform-building-blocks
parameters:
SonarCloudProjectKey: SkillsFundingAgency_das-apply-service
ContinueOnVulnerablePackageScanError: true

- task: DotNetCoreCLI@2
displayName: 'Pack Types'
inputs:
command: pack
packagesToPack: 'src/SFA.DAS.ApplyService.Types/SFA.DAS.ApplyService.Types.csproj'
versioningScheme: byBuildNumber
packDirectory: $(build.artifactstagingdirectory)/NugetPackages

- task: DotNetCoreCLI@2
displayName: 'Publish Website'
inputs:
command: publish
publishWebProjects: false
projects: src/${{ parameters.SolutionBaseName }}.Web/${{ parameters.SolutionBaseName }}.Web.csproj
arguments: -o $(build.artifactstagingdirectory)/publish -c ${{ parameters.BuildConfiguration }} --no-build

- task: DotNetCoreCLI@2
displayName: 'Publish API'
inputs:
command: publish
publishWebProjects: false
projects: src/${{ parameters.SolutionBaseName }}.InternalApi/${{ parameters.SolutionBaseName }}.InternalApi.csproj
arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)/publish --no-restore --no-build'

- task: CopyFiles@2
displayName: Copy Files to $(build.artifactstagingdirectory)/publish
inputs:
Contents: |
azure/**
TargetFolder: $(build.artifactstagingdirectory)/publish
OverWrite: true

- task: PublishPipelineArtifact@1
displayName: Publish Build Artifact
inputs:
targetPath: $(build.artifactstagingdirectory)/publish
artifactName: ${{ parameters.SolutionBaseName }}
27 changes: 27 additions & 0 deletions pipeline-templates/job/dacpac-buid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
jobs:
- job: DacpacBuild
dependsOn: CodeBuild
pool:
name: DAS - Continuous Integration
workspace:
clean: all
steps:
- task: VSBuild@1
displayName: Build DACPAC
inputs:
solution: 'src/SFA.DAS.ApplyService.Database/SFA.DAS.ApplyService.Database.sqlproj'
platform: any cpu
configuration: release
msbuildArgs: /p:PackageLocation="$(build.artifactstagingdirectory)/publish"

- task: CopyFiles@2
displayName: Copy Files to - $(build.artifactstagingdirectory)
inputs:
contents: |
src/**/*.dacpac
targetFolder: $(build.artifactstagingdirectory)/publish

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
pathtoPublish: '$(build.artifactstagingdirectory)/publish'
Loading

0 comments on commit f140619

Please sign in to comment.