-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathazure-pipelines.yml
60 lines (48 loc) · 1.86 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- dev
pool:
vmImage: 'ubuntu-latest'
variables:
tagName: '$(Build.BuildNumber)'
repoName: 'identityserver'
stableImageName: '$(dockerId)/$(repoName):stable'
latestImageName: '$(dockerId)/$(repoName):latest'
branchImageName: '$(dockerId)/$(repoName):$(Build.SourceBranchName)'
imageName: '$(dockerId)/$(repoName):$(tagName)'
buildConfiguration: 'Release'
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 3.1.x
- script: dotnet --info
displayName: 'dotnet info'
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- script: docker build -f ./src/Skoruba.IdentityServer4.STS.Identity/Dockerfile -t $(imageName) -t $(branchImageName) -t $(latestImageName) -t $(stableImageName) .
displayName: 'docker build'
- script: |
docker login -u $(dockerId) -p $(pswd)
docker push $(imageName)
docker push $(branchImageName)
displayName: 'Push docker image'
- script: |
docker push $(latestImageName)
displayName: 'Push latest image'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
- script: docker push $(stableImageName)
displayName: 'Push stable image'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- task: SSH@0
displayName: 'Run shell inline on remote machine'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
inputs:
sshEndpoint: 'weihanli-vm'
runOptions: inline
inline: |
kubectl set image deployment/identityserver identityserver=$(imageName) --record=true