-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathazure-k8s-deployment-using-environment.yaml
More file actions
70 lines (66 loc) · 1.9 KB
/
Copy pathazure-k8s-deployment-using-environment.yaml
File metadata and controls
70 lines (66 loc) · 1.9 KB
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
61
62
63
64
65
66
67
68
69
70
trigger:
- master
pool:
name: Self-Hosted-Agent
variables:
- group: dev
stages:
- stage: Build
jobs:
- job:
displayName: Build the application
steps:
- task: Go@0
displayName: "Go Get"
inputs:
command: 'get'
arguments: '-d'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: Go@0
displayName: "Go Build"
inputs:
command: 'build'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: qetza.replacetokens.replacetokens-task.replacetokens@3
displayName: 'Replace image version in deployment.yaml'
inputs:
rootDirectory: '$(System.DefaultWorkingDirectory)'
targetFiles: 'deployment.yaml'
tokenPrefix: '#{'
tokenSuffix: '}#'
- task: CopyFiles@2
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)'
Contents: 'deployment.yaml'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
artifactName: drop
- task: Docker@2
displayName: Build an image
inputs:
command: build
dockerfile: '$(System.DefaultWorkingDirectory)/Dockerfile'
buildContext: '$(System.DefaultWorkingDirectory)'
repository: $(AWS_ECR_MAGE_URI)
- task: ECRPushImage@1
inputs:
awsCredentials: 'AWS_Service'
regionName: $(AWS_REGION)
imageSource: 'imagename'
sourceImageName: $(AWS_ECR_MAGE_URI)
sourceImageTag: $(Build.BuildId)
pushTag: $(Build.BuildId)
repositoryName: $(AWS_ECR_REPOSITORY_NAME)
- stage: Dev
dependsOn: Build
jobs:
- deployment:
displayName: Dev deploy
environment: dev
strategy:
runOnce:
deploy:
steps:
- script: kubectl apply -f deployment.yaml
displayName: 'Dev Deploy'