248 строки
7.3 KiB
YAML
248 строки
7.3 KiB
YAML
trigger:
|
|
- master
|
|
|
|
pr:
|
|
- master
|
|
|
|
variables:
|
|
buildPlatform: 'Any CPU'
|
|
buildConfiguration: 'Release'
|
|
|
|
stages:
|
|
- stage: Build
|
|
jobs:
|
|
- job: BuildNet6
|
|
displayName: '.NET 6 WebApp'
|
|
pool:
|
|
vmImage: 'ubuntu-latest'
|
|
steps:
|
|
- task: UseDotNet@2
|
|
inputs:
|
|
packageType: 'sdk'
|
|
version: '3.x'
|
|
|
|
- task: UseDotNet@2
|
|
inputs:
|
|
packageType: 'sdk'
|
|
useGlobalJson: true
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'Install GitVersion'
|
|
inputs:
|
|
command: 'custom'
|
|
custom: 'tool'
|
|
arguments: 'install --global GitVersion.Tool --version 5.5.0'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'Update Version'
|
|
inputs:
|
|
command: 'custom'
|
|
custom: 'gitversion'
|
|
arguments: '/output buildserver /nofetch'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: dotnet build
|
|
inputs:
|
|
command: 'build'
|
|
projects: 'wwt-website-net6.slnf'
|
|
arguments: '--configuration $(buildConfiguration)'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: dotnet test
|
|
inputs:
|
|
command: 'test'
|
|
projects: 'wwt-website-net6.slnf'
|
|
arguments: '--configuration $(buildConfiguration)'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: dotnet publish
|
|
inputs:
|
|
command: 'publish'
|
|
publishWebProjects: false
|
|
zipAfterPublish: true
|
|
modifyOutputPath: true
|
|
projects: 'src/WWT.Web/WWT.Web.csproj'
|
|
arguments: '--configuration $(buildConfiguration) -o $(Build.ArtifactStagingDirectory)/website'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Create tool package
|
|
inputs:
|
|
command: 'pack'
|
|
packagesToPack: 'tools/PlateManager/PlateManager.csproj'
|
|
packDirectory: '$(Build.ArtifactStagingDirectory)/tools'
|
|
versioningScheme: 'off'
|
|
|
|
- publish: $(build.artifactStagingDirectory)/tools
|
|
displayName: Publish tools
|
|
artifact: tools
|
|
|
|
- publish: $(build.artifactStagingDirectory)/website
|
|
displayName: Publish net6-web
|
|
artifact: net6-web
|
|
|
|
- job: BuildMVC5
|
|
displayName: 'ASP.NET MVC5 WebApp'
|
|
pool:
|
|
vmImage: 'windows-latest'
|
|
steps:
|
|
- task: UseDotNet@2
|
|
inputs:
|
|
packageType: 'sdk'
|
|
version: '3.x'
|
|
|
|
- task: UseDotNet@2
|
|
inputs:
|
|
packageType: 'sdk'
|
|
useGlobalJson: true
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'Install GitVersion'
|
|
inputs:
|
|
command: 'custom'
|
|
custom: 'tool'
|
|
arguments: 'install --global GitVersion.Tool --version 5.5.0'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'Update Version'
|
|
inputs:
|
|
command: 'custom'
|
|
custom: 'gitversion'
|
|
arguments: '/output buildserver /nofetch'
|
|
|
|
- task: NuGetToolInstaller@1
|
|
|
|
- task: NuGetCommand@2
|
|
inputs:
|
|
restoreSolution: 'wwt-website.sln'
|
|
feedsToUse: config
|
|
nugetConfigPath: NuGet.config
|
|
|
|
- task: Npm@1
|
|
displayName: npm install
|
|
inputs:
|
|
command: 'install'
|
|
workingDir: 'src/WWTMVC5'
|
|
|
|
- task: Npm@1
|
|
displayName: npm install -g bower
|
|
inputs:
|
|
command: 'custom'
|
|
customCommand: 'install -g bower'
|
|
|
|
- task: PowerShell@2
|
|
displayName: Run init.ps1
|
|
inputs:
|
|
filePath: 'init.ps1'
|
|
|
|
- task: VSBuild@1
|
|
inputs:
|
|
solution: 'wwt-website.sln'
|
|
msbuildArgs: '/p:DeployOnBuild=true /p:PrecompileBeforePublish=true /p:EnableUpdateable=false /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)/website"'
|
|
platform: '$(buildPlatform)'
|
|
configuration: '$(buildConfiguration)'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
inputs:
|
|
command: 'test'
|
|
projects: 'wwt-website-net6.slnf'
|
|
arguments: '--configuration $(buildConfiguration)'
|
|
|
|
- publish: $(build.artifactStagingDirectory)/website
|
|
artifact: mvc5
|
|
|
|
- job: BuildDocker
|
|
displayName: 'Docker Image'
|
|
pool:
|
|
vmImage: 'Ubuntu-latest'
|
|
|
|
steps:
|
|
- task: Docker@2
|
|
displayName: Build image
|
|
inputs:
|
|
repository: 'aasworldwidetelescope/core-data'
|
|
command: 'build'
|
|
Dockerfile: '$(Build.SourcesDirectory)/Dockerfile'
|
|
buildContext: '$(Build.SourcesDirectory)'
|
|
tags: |
|
|
latest
|
|
|
|
- bash: |
|
|
set -xeuo pipefail
|
|
mkdir $(build.artifactStagingDirectory)/dockerImage
|
|
docker save -o $(build.artifactStagingDirectory)/dockerImage/core-data.tar.gz \
|
|
aasworldwidetelescope/core-data:latest
|
|
displayName: Save image as artifact
|
|
|
|
- publish: $(build.artifactStagingDirectory)/dockerImage
|
|
artifact: dockerImage
|
|
|
|
- stage: Deploy
|
|
dependsOn: Build
|
|
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
|
|
jobs:
|
|
- job: Tools
|
|
pool:
|
|
vmImage: 'ubuntu-latest'
|
|
steps:
|
|
- checkout: none
|
|
- download: current
|
|
artifact: tools
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Push tools to feed
|
|
inputs:
|
|
command: 'push'
|
|
packagesToPush: '$(Pipeline.Workspace)/tools/*.nupkg'
|
|
nuGetFeedType: 'internal'
|
|
publishVstsFeed: '5b8413f0-309f-4655-933b-c3b9516cd60f/cec2a436-ea5b-41d3-a4d4-8f2380a4c6a9'
|
|
|
|
# This job deploys the updated Windows app to the "stage" deployment slot of
|
|
# the Windows app service. To bring those changes into production, the stage
|
|
# and main slots should be "swapped" in the Azure UI, after warming up the
|
|
# new app and doing any final testing.
|
|
|
|
- job: AzureAppService
|
|
pool:
|
|
vmImage: 'windows-latest'
|
|
steps:
|
|
- checkout: none
|
|
- download: current
|
|
artifact: mvc5
|
|
- task: AzureRmWebAppDeployment@4
|
|
displayName: Deploy to App Service
|
|
inputs:
|
|
ConnectionType: 'AzureRM'
|
|
azureSubscription: 'aas@wwtadmindotnetfoundation'
|
|
appType: 'webApp'
|
|
WebAppName: 'wwtcoreapp-app-service'
|
|
deployToSlotOrASE: true
|
|
ResourceGroupName: 'wwtcoreapp-resources'
|
|
SlotName: 'stage'
|
|
packageForLinux: '$(Pipeline.Workspace)/mvc5/WWTMVC5.zip'
|
|
DeploymentType: 'webDeploy'
|
|
RemoveAdditionalFilesFlag: true
|
|
|
|
# This job deploys the new Docker image to Docker Hub under the `latest`
|
|
# tag, which will then trigger an update of the "stage" deployment slot of
|
|
# the Linux core data app service. To bring the new image into production,
|
|
# the stage and main slots should be "swapped" in the Azure UI, after
|
|
# warming up the new app and doing any final testing.
|
|
|
|
- job: DockerImage
|
|
pool:
|
|
vmImage: 'ubuntu-latest'
|
|
steps:
|
|
- checkout: none
|
|
- download: current
|
|
artifact: dockerImage
|
|
- bash: |
|
|
docker load -i $(Pipeline.Workspace)/dockerImage/core-data.tar.gz
|
|
displayName: Load image from artifacts
|
|
- task: Docker@2
|
|
displayName: Push image
|
|
inputs:
|
|
containerRegistry: 'worldwidetelescope@DockerHub'
|
|
repository: 'aasworldwidetelescope/core-data'
|
|
command: 'push'
|
|
tags: |
|
|
latest
|