This repository has been archived by the owner on Feb 11, 2022. It is now read-only.
/
ci.gocd.yaml
98 lines (98 loc) · 3.66 KB
/
ci.gocd.yaml
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
pipelines:
demo_ci_pipeline:
group: demo_group
materials:
demo_git: # name of material
git: https://github.com/ThoughtWorksInc/ml-app-template.git
stages:
- commit: # name of stage
clean_workspace: true
jobs:
build_and_test: # name of the job
elastic_profile_id: demo-app
tasks:
- exec: # indicates type of task
command: bash
arguments:
- -c
- docker build . -t davified/ml-app-template:v${GO_PIPELINE_LABEL} --target Base
- exec:
command: bash
arguments:
- -c
- docker run davified/ml-app-template:v${GO_PIPELINE_LABEL} bin/test.sh
- exec:
command: bash
arguments:
- -c
- docker build . -t davified/ml-app-template:v${GO_PIPELINE_LABEL} --target Build --build-arg CI=true
- exec:
command: bash
arguments:
- -c
- docker run davified/ml-app-template:v${GO_PIPELINE_LABEL} bin/test_model_metrics.sh
- exec:
command: bash
arguments:
- -c
- echo "v${GO_PIPELINE_LABEL}" > docker_image_tag.txt
artifacts:
- external:
id: docker-release-candidate
store_id: dockerhub # artifact store id (configured on gocd UI)
configuration:
options:
Image: davified/ml-app-template
Tag: v${GO_PIPELINE_LABEL}
- build:
source: docker_image_tag.txt
destination: metadata # destination directory is relative to the artifacts folder on go server
- deploy_staging:
clean_workspace: true
jobs:
deploy_staging:
elastic_profile_id: docker-dind-kubectl
tasks:
- exec:
command: bash
arguments:
- -c
- kubectl set image deployment/ml-cd-starter-kit-ml-app-template ml-app-template=davified/ml-app-template:v${GO_PIPELINE_LABEL} # ml-app-template is the name of the chart in ml-cd-starter-kit
- deploy_prod:
clean_workspace: true
approval:
type: manual
jobs:
deploy_staging:
elastic_profile_id: docker-dind-kubectl
tasks:
- exec:
command: bash
arguments:
- -c
- kubectl set image deployment/ml-cd-starter-kit-prod-ml-app-template ml-app-template=davified/ml-app-template:v${GO_PIPELINE_LABEL} # update the container used by deployment/ml-cd-starter-kit-PROD-ml-app-template
# second pipeline
evaluate_model:
group: demo_group
materials:
myupstream:
pipeline: demo_ci_pipeline
stage: commit
stages:
- default_stage:
clean_workspace: true
jobs:
default_job:
elastic_profile_id: demo-app
tasks:
- fetch:
pipeline: demo_ci_pipeline
stage: commit
job: build_and_test
source: metadata
destination: .
- exec:
command: bash
arguments:
- -c
- docker run davified/ml-app-template:$(cat metadata/docker_image_tag.txt) bin/test_model_metrics.sh