Skip to content

Commit 635eb6f

Browse files
authored
Merge pull request #786 from MetaCell/fix/CH-166
CH-166 fix codefresh post-clone
2 parents 34cdb06 + d432ec7 commit 635eb6f

6 files changed

Lines changed: 136 additions & 12 deletions

File tree

deployment-configuration/codefresh-template-dev.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ steps:
1919
type: parallel
2020
stage: prepare
2121
steps:
22-
- title: Cloning cloud-harness repository...
22+
clone_cloud_harness:
23+
title: Cloning cloud-harness repository...
2324
type: git-clone
2425
stage: prepare
2526
repo: "https://github.com/MetaCell/cloud-harness.git"

deployment-configuration/codefresh-template-prod.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ steps:
1515
type: parallel
1616
stage: prepare
1717
steps:
18-
- title: Cloning cloud-harness repository...
18+
clone_cloud_harness:
19+
title: Cloning cloud-harness repository...
1920
type: git-clone
2021
stage: prepare
2122
repo: "https://github.com/MetaCell/cloud-harness.git"

deployment-configuration/codefresh-template-stage.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ steps:
1818
type: parallel
1919
stage: prepare
2020
steps:
21-
- title: Cloning cloud-harness repository...
21+
clone_cloud_harness:
22+
title: Cloning cloud-harness repository...
2223
type: git-clone
2324
stage: prepare
2425
repo: "https://github.com/MetaCell/cloud-harness.git"

deployment-configuration/codefresh-template-test.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ steps:
1818
type: parallel
1919
stage: prepare
2020
steps:
21-
- title: Cloning cloud-harness repository...
21+
clone_cloud_harness:
22+
title: Cloning cloud-harness repository...
2223
type: git-clone
2324
stage: prepare
2425
repo: "https://github.com/MetaCell/cloud-harness.git"

deployment/codefresh-test.yaml

Lines changed: 126 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,28 @@ steps:
1313
repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}'
1414
revision: '${{CF_BRANCH}}'
1515
git: github
16-
16+
post_main_clone:
17+
title: Post main clone
18+
type: parallel
19+
stage: prepare
20+
steps:
21+
clone_cloud_harness:
22+
title: Cloning cloud-harness repository...
23+
type: git-clone
24+
stage: prepare
25+
repo: https://github.com/MetaCell/cloud-harness.git
26+
revision: '${{CLOUDHARNESS_BRANCH}}'
27+
working_directory: .
28+
git: github
1729
prepare_deployment:
1830
title: Prepare helm chart
1931
image: python:3.12
2032
stage: prepare
2133
working_directory: .
2234
commands:
23-
- bash install.sh
24-
- harness-deployment . -n test-${{NAMESPACE_BASENAME}} -d ${{DOMAIN}} -r ${{REGISTRY}}
25-
-rs ${{REGISTRY_SECRET}} -e test --write-env -N -i samples
35+
- bash cloud-harness/install.sh
36+
- 'harness-deployment . -n test-${{NAMESPACE_BASENAME}} -d ${{DOMAIN}} -r ${{REGISTRY}}
37+
-rs ${{REGISTRY_SECRET}} -e test --write-env -N '
2638
- cat deployment/.env >> ${{CF_VOLUME_PATH}}/env_vars_to_export
2739
- cat ${{CF_VOLUME_PATH}}/env_vars_to_export
2840
prepare_deployment_view:
@@ -112,6 +124,49 @@ steps:
112124
type: parallel
113125
stage: build
114126
steps:
127+
nfsserver:
128+
type: build
129+
stage: build
130+
dockerfile: Dockerfile
131+
registry: '${{CODEFRESH_REGISTRY}}'
132+
buildkit: true
133+
build_arguments:
134+
- DOMAIN=${{DOMAIN}}
135+
- NOCACHE=${{CF_BUILD_ID}}
136+
- REGISTRY=${{REGISTRY}}/cloudharness/
137+
image_name: cloudharness/nfsserver
138+
title: Nfsserver
139+
working_directory: ./applications/nfsserver
140+
tag: '${{NFSSERVER_TAG}}'
141+
when:
142+
condition:
143+
any:
144+
buildDoesNotExist: includes('${{NFSSERVER_TAG_EXISTS}}', '{{NFSSERVER_TAG_EXISTS}}')
145+
== true
146+
forceNoCache: includes('${{NFSSERVER_TAG_FORCE_BUILD}}', '{{NFSSERVER_TAG_FORCE_BUILD}}')
147+
== false
148+
notifications:
149+
type: build
150+
stage: build
151+
dockerfile: Dockerfile
152+
registry: '${{CODEFRESH_REGISTRY}}'
153+
buildkit: true
154+
build_arguments:
155+
- DOMAIN=${{DOMAIN}}
156+
- NOCACHE=${{CF_BUILD_ID}}
157+
- REGISTRY=${{REGISTRY}}/cloudharness/
158+
- CLOUDHARNESS_BASE=${{REGISTRY}}/cloudharness/cloudharness-base:${{CLOUDHARNESS_BASE_TAG}}
159+
image_name: cloudharness/notifications
160+
title: Notifications
161+
working_directory: ./applications/notifications/server
162+
tag: '${{NOTIFICATIONS_TAG}}'
163+
when:
164+
condition:
165+
any:
166+
buildDoesNotExist: includes('${{NOTIFICATIONS_TAG_EXISTS}}', '{{NOTIFICATIONS_TAG_EXISTS}}')
167+
== true
168+
forceNoCache: includes('${{NOTIFICATIONS_TAG_FORCE_BUILD}}', '{{NOTIFICATIONS_TAG_FORCE_BUILD}}')
169+
== false
115170
accounts:
116171
type: build
117172
stage: build
@@ -133,6 +188,49 @@ steps:
133188
== true
134189
forceNoCache: includes('${{ACCOUNTS_TAG_FORCE_BUILD}}', '{{ACCOUNTS_TAG_FORCE_BUILD}}')
135190
== false
191+
volumemanager:
192+
type: build
193+
stage: build
194+
dockerfile: Dockerfile
195+
registry: '${{CODEFRESH_REGISTRY}}'
196+
buildkit: true
197+
build_arguments:
198+
- DOMAIN=${{DOMAIN}}
199+
- NOCACHE=${{CF_BUILD_ID}}
200+
- REGISTRY=${{REGISTRY}}/cloudharness/
201+
- CLOUDHARNESS_FLASK=${{REGISTRY}}/cloudharness/cloudharness-flask:${{CLOUDHARNESS_FLASK_TAG}}
202+
image_name: cloudharness/volumemanager
203+
title: Volumemanager
204+
working_directory: ./applications/volumemanager/server
205+
tag: '${{VOLUMEMANAGER_TAG}}'
206+
when:
207+
condition:
208+
any:
209+
buildDoesNotExist: includes('${{VOLUMEMANAGER_TAG_EXISTS}}', '{{VOLUMEMANAGER_TAG_EXISTS}}')
210+
== true
211+
forceNoCache: includes('${{VOLUMEMANAGER_TAG_FORCE_BUILD}}', '{{VOLUMEMANAGER_TAG_FORCE_BUILD}}')
212+
== false
213+
sentry:
214+
type: build
215+
stage: build
216+
dockerfile: Dockerfile
217+
registry: '${{CODEFRESH_REGISTRY}}'
218+
buildkit: true
219+
build_arguments:
220+
- DOMAIN=${{DOMAIN}}
221+
- NOCACHE=${{CF_BUILD_ID}}
222+
- REGISTRY=${{REGISTRY}}/cloudharness/
223+
image_name: cloudharness/sentry
224+
title: Sentry
225+
working_directory: ./applications/sentry
226+
tag: '${{SENTRY_TAG}}'
227+
when:
228+
condition:
229+
any:
230+
buildDoesNotExist: includes('${{SENTRY_TAG_EXISTS}}', '{{SENTRY_TAG_EXISTS}}')
231+
== true
232+
forceNoCache: includes('${{SENTRY_TAG_FORCE_BUILD}}', '{{SENTRY_TAG_FORCE_BUILD}}')
233+
== false
136234
jupyterhub:
137235
type: build
138236
stage: build
@@ -378,6 +476,11 @@ steps:
378476
custom_value_files:
379477
- ./deployment/helm/values.yaml
380478
custom_values:
479+
- apps_notifications_harness_secrets_email-user=${{EMAIL-USER}}
480+
- apps_notifications_harness_secrets_email-password=${{EMAIL-PASSWORD}}
481+
- apps_sentry_harness_secrets_email-server=${{EMAIL-SERVER}}
482+
- apps_sentry_harness_secrets_email-user=${{EMAIL-USER}}
483+
- apps_sentry_harness_secrets_email-password=${{EMAIL-PASSWORD}}
381484
- apps_samples_harness_secrets_asecret=${{ASECRET}}
382485
build_test_images:
383486
title: Build test images
@@ -434,8 +537,13 @@ steps:
434537
commands:
435538
- kubectl config use-context ${{CLUSTER_NAME}}
436539
- kubectl config set-context --current --namespace=test-${{NAMESPACE_BASENAME}}
540+
- kubectl rollout status deployment/notifications
437541
- kubectl rollout status deployment/accounts
542+
- kubectl rollout status deployment/volumemanager
543+
- kubectl rollout status deployment/sentry
544+
- kubectl rollout status deployment/argo-server-gk
438545
- kubectl rollout status deployment/samples
546+
- kubectl rollout status deployment/samples-gk
439547
- kubectl rollout status deployment/common
440548
- kubectl rollout status deployment/workflows
441549
- sleep 60
@@ -448,6 +556,18 @@ steps:
448556
commands:
449557
- echo $APP_NAME
450558
scale:
559+
volumemanager_api_test:
560+
title: volumemanager api test
561+
volumes:
562+
- '${{CF_REPO_NAME}}/applications/volumemanager:/home/test'
563+
- '${{CF_REPO_NAME}}/deployment/helm/values.yaml:/opt/cloudharness/resources/allvalues.yaml'
564+
environment:
565+
- APP_URL=https://volumemanager.${{DOMAIN}}/api
566+
- USERNAME=volumes@testuser.com
567+
- PASSWORD=test
568+
commands:
569+
- st --pre-run cloudharness_test.apitest_init run api/openapi.yaml --base-url
570+
https://volumemanager.${{DOMAIN}}/api -c all
451571
samples_api_test:
452572
title: samples api test
453573
volumes:
@@ -522,7 +642,7 @@ steps:
522642
approval:
523643
type: pending-approval
524644
stage: qa
525-
title: Approve anyway
645+
title: Approve anyway and delete deployment
526646
description: The pipeline will fail after ${{WAIT_ON_FAIL}} minutes
527647
timeout:
528648
timeUnit: minutes
@@ -531,4 +651,4 @@ steps:
531651
when:
532652
condition:
533653
all:
534-
error: '"${{FAILED}}" == "failed"'
654+
error: '"${{FAILED}}" == "failed"'

tools/deployment-cli-tools/ch_cli_tools/codefresh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
from os.path import join, relpath, exists, dirname
2+
from os.path import join, relpath, exists, dirname, basename
33
from cloudharness_model.models.git_dependency_config import GitDependencyConfig
44
import requests
55
import logging
@@ -175,7 +175,7 @@ def codefresh_steps_from_base_path(base_path, build_step, fixed_context=None, in
175175

176176
if app_config and app_config.dependencies and app_config.dependencies.git:
177177
for dep in app_config.dependencies.git:
178-
steps[CD_BUILD_STEP_DEPENDENCIES]['steps'].append(clone_step_spec(dep, dockerfile_relative_to_root))
178+
steps[CD_BUILD_STEP_DEPENDENCIES]['steps'][f"clone_{basename(dep.url).replace(".", "_")}_{basename(dockerfile_relative_to_root).replace(".", "_")}"] = clone_step_spec(dep, dockerfile_relative_to_root)
179179

180180
build = None
181181
if build_step in steps:

0 commit comments

Comments
 (0)