-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcodefresh-template-stage.yaml
142 lines (142 loc) · 3.89 KB
/
codefresh-template-stage.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
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
version: "1.0"
stages:
- prepare
- build
- 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
- harness-deployment $PATHS -t ${{DEPLOYMENT_TAG}} -d ${{DOMAIN}} -r ${{REGISTRY}} -rs ${{REGISTRY_SECRET}} -n ${{NAMESPACE}} -e $ENV $PARAMS
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"
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: ${{DEPLOYMENT_TAG}}
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}}
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:
- yarn test
scale: {}
when:
condition:
all:
whenVarExists: 'includes("${{SKIP_TESTS}}", "{{SKIP_TESTS}}") == true'
manual_tests:
type: pending-approval
stage: publish
title: Manual tests performed
description: Manual tests have been performed and reported
timeout:
duration: 168
finalState: approved
approval:
type: pending-approval
stage: publish
title: Approve release
description: Approve release and tagging/publication
timeout:
duration: 168
finalState: approved
publish:
type: parallel
stage: publish
steps: REPLACE_ME
when:
condition:
all:
whenVarExists: 'includes("${{DEPLOYMENT_PUBLISH_TAG}}", "{{DEPLOYMENT_PUBLISH_TAG}}") == false'
git-tag:
title: Performing git tagging
stage: publish
image: alpine/git:latest
commands:
- git tag ${{DEPLOYMENT_PUBLISH_TAG}}
- ORIGIN=$(git remote get-url origin)
- PROTOCOL=https://
- REPLACEMENT=${PROTOCOL}${{REPO_TOKEN}}@
- git remote set-url origin ${ORIGIN/$PROTOCOL/$REPLACEMENT}
- git push origin --tags
when:
condition:
all:
whenVarExists: 'includes("${{DEPLOYMENT_PUBLISH_TAG}}", "{{DEPLOYMENT_PUBLISH_TAG}}") == false'
whenVarExists2: 'includes("${{REPO_TOKEN}}", "{{REPO_TOKEN}}") == false'