-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcodefresh-template-dev.yaml
More file actions
147 lines (145 loc) · 4.34 KB
/
codefresh-template-dev.yaml
File metadata and controls
147 lines (145 loc) · 4.34 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
version: "1.0"
stages:
- prepare
- build
- unittest
- deploy
- qa
- publish
steps:
main_clone:
title: Clone main repository
type: git-clone
stage: prepare
repo: "${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}"
revision: "${{CF_BRANCH}}"
git: github
post_main_clone:
title: Post main clone
type: parallel
stage: prepare
steps:
clone_cloud_harness:
title: Cloning cloud-harness repository...
type: git-clone
stage: prepare
repo: "https://github.com/MetaCell/cloud-harness.git"
revision: "${{CLOUDHARNESS_BRANCH}}"
working_directory: .
git: github
prepare_deployment:
title: "Prepare helm chart"
image: python:3.12
stage: prepare
working_directory: .
commands:
- bash cloud-harness/install.sh
- export HELM_NAME_ARG="$( [ -n "${{CHART_NAME}}" ] && printf -- "--name %s" "${{CHART_NAME}}" )"
- export HELM_CHART_VERSION_ARG="$( [ -n "${{CHART_VERSION}}" ] && printf -- "--chart-version %s" "${{CHART_VERSION}}" )"
- export HELM_APP_VERSION_ARG="$( APP_VERSION_RESOLVED="${{APP_VERSION}}"; [ -z "$APP_VERSION_RESOLVED" ] && APP_VERSION_RESOLVED="${{DEPLOYMENT_TAG}}"; [ -n "$APP_VERSION_RESOLVED" ] && printf -- "--app-version %s" "$APP_VERSION_RESOLVED" )"
- export HELM_META_ARGS="$HELM_NAME_ARG $HELM_CHART_VERSION_ARG $HELM_APP_VERSION_ARG"
- harness-deployment $PATHS -d ${{DOMAIN}} -r ${{REGISTRY}} -rsn '${{REGISTRY_SECRET}}' -n ${{NAMESPACE}} --write-env -e $ENV --cache-url '${{IMAGE_CACHE_URL}}' $HELM_META_ARGS $PARAMS
- cat deployment/.env >> ${{CF_VOLUME_PATH}}/env_vars_to_export
- cat ${{CF_VOLUME_PATH}}/env_vars_to_export
prepare_deployment_view:
commands:
- "helm template ./deployment/helm --debug -n ${{NAMESPACE}}"
environment:
- ACTION=auth
- KUBE_CONTEXT=${{NAMESPACE}}
image: codefresh/cfstep-helm:3.6.2
stage: prepare
title: "View helm chart"
build_application_images:
type: parallel
stage: build
steps: {}
# placeholders for sequential build steps
build_application_images_0:
build_application_images_1:
build_application_images_2:
build_application_images_3:
build_application_images_4:
build_application_images_5:
tests_unit:
stage: unittest
type: parallel
steps: {}
deployment:
stage: deploy
type: helm
working_directory: ./${{CF_REPO_NAME}}
title: Installing chart
arguments:
helm_version: 3.6.2
chart_name: deployment/helm
release_name: ${{NAMESPACE}}
kube_context: ${{CLUSTER_NAME}}
namespace: ${{NAMESPACE}}
chart_version: ${{CF_BUILD_ID}}
cmd_ps: --wait --timeout 600s --create-namespace
custom_value_files:
- ./deployment/helm/values.yaml
build_test_images:
title: Build test images
type: parallel
stage: qa
steps: []
when:
condition:
all:
whenVarExists: 'includes("${{SKIP_TESTS}}", "{{SKIP_TESTS}}") == true'
wait_deployment:
stage: qa
title: Wait deployment to be ready
image: codefresh/kubectl
commands:
- kubectl config use-context ${{CLUSTER_NAME}}
- kubectl config set-context --current --namespace=${{NAMESPACE}}
when:
condition:
all:
whenVarExists: 'includes("${{SKIP_TESTS}}", "{{SKIP_TESTS}}") == true'
tests_api:
stage: qa
title: Api tests
working_directory: /home/test
image: "${{test-api}}"
fail_fast: false
commands:
- echo $APP_NAME
scale: {}
when:
condition:
all:
whenVarExists: 'includes("${{SKIP_TESTS}}", "{{SKIP_TESTS}}") == true'
tests_e2e:
stage: qa
title: End to end tests
working_directory: /home/test
image: "${{test-e2e}}"
fail_fast: false
commands:
- npx puppeteer browsers install chrome
- yarn test
scale: {}
when:
condition:
all:
whenVarExists: 'includes("${{SKIP_TESTS}}", "{{SKIP_TESTS}}") == true'
approval:
type: pending-approval
stage: publish
title: Approve build
description: Approve build release and tagging
timeout:
duration: 168
finalState: denied
publish:
type: parallel
stage: publish
steps: {}
when:
condition:
all:
whenVarExists: 'includes("${{DEPLOYMENT_PUBLISH_TAG}}", "{{DEPLOYMENT_PUBLISH_TAG}}") == false'