-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
93 lines (74 loc) · 2.21 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
trigger:
branches:
include:
- main
- develop
pr:
- main
- develop
pool:
vmImage: "ubuntu-latest"
variables:
buildConfiguration: 'Release'
workingDir: $(System.DefaultWorkingDirectory)
steps:
#Get a version hash for this image
- script: |
VERSION_TAG=`git describe --abbrev=0 --tags`
echo "##vso[task.setvariable variable=VERSION_TAG]$VERSION_TAG"
IMAGE_TAGS="${VERSION_TAG}_$(Build.SourceVersion)"
echo "##vso[task.setvariable variable=IMAGE_SEMANTIC_HASH]$IMAGE_TAGS"
echo Tags: $IMAGE_TAGS
echo "##vso[task.setvariable variable=IMAGE_TAGS]$IMAGE_TAGS"
displayName: Get git tag
- task: NodeTool@0
inputs:
versionSpec: "14.x"
displayName: "Install Node.js"
- script: npm ci
workingDirectory: "$(workingDir)/nodejs"
displayName: "npm install"
#Normally I'd want to run some tests/do some automated linting here, for a simple static frontend host this feels like overkill
- task: Docker@2
inputs:
containerRegistry: 'DockerHub'
command: 'login'
- task: Docker@2
displayName: Docker build
inputs:
containerRegistry: 'DockerHub'
repository: 'swarmidentity/resume'
command: 'build'
buildContext: '$(workingDir)/nodejs'
Dockerfile: '$(workingDir)/nodejs/Dockerfile'
tags: |
$(IMAGE_TAGS)
- task: Docker@2
displayName: Publish image
inputs:
containerRegistry: 'DockerHub'
repository: 'swarmidentity/resume'
command: 'push'
tags: |
$(IMAGE_TAGS)
- task: HelmInstaller@1
inputs:
helmVersionToInstall: latest
- task: Bash@3
inputs:
targetType: 'inline'
script: |
sed -i 's/tag:.*/tag: $(IMAGE_SEMANTIC_HASH)/' $(workingDir)/deployment/louis-racette/values.yaml
- task: HelmDeploy@0
displayName: Package Helm Chart
inputs:
command: package
chartPath: $(workingDir)/deployment/louis-racette
destination: $(Build.ArtifactStagingDirectory)
updatedependency: false
- task: PublishBuildArtifacts@1
displayName: Publish Helm chart
inputs:
PathtoPublish: "$(Build.ArtifactStagingDirectory)"
ArtifactName: "resume"
publishLocation: "Container"