forked from jfrogtraining/azure-aks-workshop
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pipelines.yml
102 lines (100 loc) · 3.77 KB
/
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
92
93
94
95
96
97
98
99
100
101
102
template: true
valuesFilePath: values.yml
resources:
- name: git_repo
type: GitRepo
configuration:
path: {{ .Values.GitHub.path }}
gitProvider: github_integration
branches:
include: master
- name: workshop_app_image
type: Image
configuration:
registry: artifactory_integration
sourceRepository: workshop-docker-local
imageName: {{ .Values.DockerBuild.dockerImageName }}
imageTag: ${run_number}
autoPull: true
- name: workshop_build_info
type: Buildinfo
configuration:
sourceArtifactory: artifactory_integration
buildName: workshop_build
buildNumber: ${run_number}
- name: promoted_workshop_build_info
type: Buildinfo
configuration:
sourceArtifactory: artifactory_integration
buildName: workshop_build
buildNumber: ${run_number}
pipelines:
- name: workshop_app_build
steps:
- name: docker_build
type: DockerBuild
configuration:
affinityGroup: docker_build
dockerFileLocation: workshop-app
dockerFileName: Dockerfile
dockerImageName: {{ .Values.DockerBuild.dockerImageName }}
dockerImageTag: ${run_number}
inputResources:
- name: git_repo
integrations:
- name: artifactory_integration
execution:
onStart:
- cd $res_git_repo_resourcePath
- sed "s|Num|${run_number}|g" $res_git_repo_resourcePath/workshop-app/src/app/app.component.html > $res_git_repo_resourcePath/workshop-app/src/app/app.component.html.update
- mv $res_git_repo_resourcePath/workshop-app/src/app/app.component.html $res_git_repo_resourcePath/workshop-app/src/app/app.component.html.orig
- mv $res_git_repo_resourcePath/workshop-app/src/app/app.component.html.update $res_git_repo_resourcePath/workshop-app/src/app/app.component.html
onSuccess:
- echo "Congrats The Docker image was built!"
- name: docker_push
type: DockerPush
configuration:
affinityGroup: docker_build
autoPublishBuildInfo: true
forceXrayScan: true
targetRepository: workshop-docker-local
integrations:
- name: artifactory_integration
inputSteps:
- name: docker_build
outputResources:
- name: workshop_app_image
- name: workshop_build_info
- name: docker_promote
type: PromoteBuild
configuration:
targetRepository: workshop-docker-prod-local
includeDependencies: true
status: Passed
comment: Artifact passed Xray Scan
copy: true
inputResources:
- name: workshop_build_info
outputResources:
- name: promoted_workshop_build_info
- name: aks_deploy
type: Bash
configuration:
integrations:
- name: aks_integration
inputResources:
- name: git_repo
inputSteps:
- name: docker_promote
execution:
onExecute:
- cd $res_git_repo_resourcePath
- pwd
- ls
- kubectl create namespace azure-aks-workshop || true
- sed "s|imageName|{{ .Values.DockerBuild.dockerImageName }}:${run_number}|g" workshop-app/deployment.yml > my-deployment.yml
- cat my-deployment.yml
- kubectl apply -f my-deployment.yml --namespace azure-aks-workshop
- while [ -z "$url" ]; do url=$(kubectl describe service workshop-app --namespace azure-aks-workshop | grep 'LoadBalancer Ingress:' | awk '{printf "https://%s",$3;}'); sleep 2; done
- echo "$url"
- echo "Workshop App launched!"