This commit is contained in:
Chris Cheetham 2021-09-28 12:06:26 -04:00
Родитель 40b8546e8a
Коммит 8436345b87
1 изменённых файлов: 130 добавлений и 129 удалений

Просмотреть файл

@ -1,136 +1,137 @@
---
trigger:
- main
- main
variables:
- name: major
value: 0
- name: minor
value: 22
- name: patch
value: 0
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: 1
- group: PackageSigningSecrets
- name: major
value: 0
- name: minor
value: 22
- name: patch
value: 0
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: 1
- group: PackageSigningSecrets
name: $(major).$(minor).$(patch)-$(Rev:r)
stages:
- stage: assemble
displayName: Assemble
jobs:
- job: build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: UseDotNet@2
displayName: 'Install .NET Core SDK 5.0'
inputs:
packageType: sdk
version: 5.0.x
- task: UseDotNet@2
displayName: 'Install .NET Core SDK 3.1'
inputs:
packageType: sdk
version: 3.1.x
- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01-2965cd301255.SonarCloudPrepare@1
displayName: Start SonarQube Analysis
inputs:
SonarCloud: SonarCloud
organization: steeltoeoss
projectKey: InitializrApi
extraProperties: |
sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/**/*.opencover.xml
- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: restore
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
arguments: --no-restore /p:TreatWarningsAsErrors=True
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
arguments: --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- task: DotNetCoreCLI@2
displayName: dotnet publish
inputs:
command: publish
arguments: --no-build
zipAfterPublish: false
- task: DotNetCoreCLI@2
displayName: dotnet pack
inputs:
command: pack
packagesToPack: src/InitializrApi.Config
arguments: --no-build
- task: Powershell@2
displayName: Sign NuGets
inputs:
filePath: sign/SignPackages.ps1
env:
ArtifactStagingDirectory: $(Build.ArtifactStagingDirectory)
SignClientUser: $(SignClientUser)
SignClientSecret: $(SignClientSecret)
- task: SonarSource.sonarcloud.ce096e50-6155-4de8-8800-4221aaeed4a1.SonarCloudAnalyze@1
displayName: Stop SonarQube Analysis
- task: SonarSource.sonarcloud.38b27399-a642-40af-bb7d-9971f69712e8.SonarCloudPublish@1
displayName: Publish SonarQube Analysis
- task: PublishBuildArtifacts@1
displayName: Publish Build Artifacts
- job: kubernetes
displayName: Kubernetes
pool:
vmImage: ubuntu-latest
steps:
- task: ShellScript@2
displayName: Generate Staging Manifest
inputs:
scriptPath: ./yttw.sh
args: >
-f kubernetes
-v image_tag=$(Build.BuildId)
-v dotnet_environment=Staging
-v hostname=start-staging.steeltoe.io
--output-files manifests/staging
- task: ShellScript@2
displayName: Generate Production Manifest
inputs:
scriptPath: ./yttw.sh
args: >
-f kubernetes
-v image_tag=$(Build.BuildId)
-v replica_count=2
-v dotnet_environment=Production
-v hostname=start.steeltoe.io
--output-files manifests/production
- task: PublishPipelineArtifact@1
displayName: Publish Manifests
inputs:
targetPath: manifests
artifactName: manifests
- stage: Deploy
displayName: Deploy
dependsOn: assemble
condition:
not(eq(variables['build.reason'], 'PullRequest'))
jobs:
- job: push
displayName: Push
pool:
vmImage: ubuntu-latest
steps:
- task: Docker@2
displayName: Build and Push
inputs:
command: buildAndPush
containerRegistry: SteeltoeContainerRegistry
repository: initializr-api
tags: |
$(Build.BuildId)
latest
- stage: assemble
displayName: Assemble
jobs:
- job: build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: UseDotNet@2
displayName: 'Install .NET Core SDK 5.0'
inputs:
packageType: sdk
version: 5.0.x
- task: UseDotNet@2
displayName: 'Install .NET Core SDK 3.1'
inputs:
packageType: sdk
version: 3.1.x
- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01-2965cd301255.SonarCloudPrepare@1
displayName: Start SonarQube Analysis
inputs:
SonarCloud: SonarCloud
organization: steeltoeoss
projectKey: InitializrApi
extraProperties: |
sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/**/*.opencover.xml
- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: restore
- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: build
arguments: --no-restore /p:TreatWarningsAsErrors=True
- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
arguments: --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- task: DotNetCoreCLI@2
displayName: dotnet publish
inputs:
command: publish
arguments: --no-build
zipAfterPublish: false
- task: DotNetCoreCLI@2
displayName: dotnet pack
inputs:
command: pack
packagesToPack: src/InitializrApi.Config
arguments: --no-build
- task: Powershell@2
displayName: Sign NuGets
inputs:
filePath: sign/SignPackages.ps1
env:
ArtifactStagingDirectory: $(Build.ArtifactStagingDirectory)
SignClientUser: $(SignClientUser)
SignClientSecret: $(SignClientSecret)
- task: SonarSource.sonarcloud.ce096e50-6155-4de8-8800-4221aaeed4a1.SonarCloudAnalyze@1
displayName: Stop SonarQube Analysis
- task: SonarSource.sonarcloud.38b27399-a642-40af-bb7d-9971f69712e8.SonarCloudPublish@1
displayName: Publish SonarQube Analysis
- task: PublishBuildArtifacts@1
displayName: Publish Build Artifacts
- job: kubernetes
displayName: Kubernetes
pool:
vmImage: ubuntu-latest
steps:
- task: ShellScript@2
displayName: Generate Staging Manifest
inputs:
scriptPath: ./yttw.sh
args: >
-f kubernetes
-v image_tag=$(Build.BuildId)
-v dotnet_environment=Staging
-v hostname=start-staging.steeltoe.io
--output-files manifests/staging
- task: ShellScript@2
displayName: Generate Production Manifest
inputs:
scriptPath: ./yttw.sh
args: >
-f kubernetes
-v image_tag=$(Build.BuildId)
-v replica_count=2
-v dotnet_environment=Production
-v hostname=start.steeltoe.io
--output-files manifests/production
- task: PublishPipelineArtifact@1
displayName: Publish Manifests
inputs:
targetPath: manifests
artifactName: manifests
- stage: Deploy
displayName: Deploy
dependsOn: assemble
condition:
not(eq(variables['build.reason'], 'PullRequest'))
jobs:
- job: push
displayName: Push
pool:
vmImage: ubuntu-latest
steps:
- task: Docker@2
displayName: Build and Push
inputs:
command: buildAndPush
containerRegistry: SteeltoeContainerRegistry
repository: initializr-api
tags: |
$(Build.BuildId)
latest