Skip to content

Commit 6308d91

Browse files
committed
fix delete test deployment logic
1 parent ac82374 commit 6308d91

2 files changed

Lines changed: 12 additions & 21 deletions

File tree

deployment-configuration/codefresh-template-test.yaml

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ steps:
3232
working_directory: .
3333
commands:
3434
- bash cloud-harness/install.sh
35-
- harness-deployment $PATHS -n test-${{NAMESPACE_BASENAME}}-${{CF_SHORT_REVISION}} -d ${{CF_SHORT_REVISION}}.${{DOMAIN}} -r ${{REGISTRY}} -rs ${{REGISTRY_SECRET}} -e $ENV --write-env -N $PARAMS
35+
- harness-deployment $PATHS -n test-${{NAMESPACE_BASENAME}} -d ${{DOMAIN}} -r ${{REGISTRY}} -rs ${{REGISTRY_SECRET}} -e $ENV --write-env -N $PARAMS
3636
- cat deployment/.env >> ${{CF_VOLUME_PATH}}/env_vars_to_export
3737
- cat ${{CF_VOLUME_PATH}}/env_vars_to_export
3838
prepare_deployment_view:
@@ -70,10 +70,10 @@ steps:
7070
arguments:
7171
helm_version: 3.6.2
7272
chart_name: deployment/helm
73-
release_name: test-${{NAMESPACE_BASENAME}}-${{CF_SHORT_REVISION}}
73+
release_name: test-${{NAMESPACE_BASENAME}}
7474
kube_context: ${{CLUSTER_NAME}}
75-
namespace: test-${{NAMESPACE_BASENAME}}-${{CF_SHORT_REVISION}}
76-
chart_version: ${{CF_BUILD_ID}}
75+
namespace: test-${{NAMESPACE_BASENAME}}
76+
chart_version: ${{CF_SHORT_REVISION}}
7777
cmd_ps: --timeout 600s --create-namespace
7878
custom_value_files:
7979
- ./deployment/helm/values.yaml
@@ -88,7 +88,7 @@ steps:
8888
image: codefresh/kubectl
8989
commands:
9090
- kubectl config use-context ${{CLUSTER_NAME}}
91-
- kubectl config set-context --current --namespace=test-${{NAMESPACE_BASENAME}}-${{CF_SHORT_REVISION}}
91+
- kubectl config set-context --current --namespace=test-${{NAMESPACE_BASENAME}}
9292
tests_api:
9393
stage: qa
9494
title: Api tests
@@ -123,7 +123,7 @@ steps:
123123
approval:
124124
type: pending-approval
125125
stage: qa
126-
title: Approve with failed tests
126+
title: Approve anyway and delete deployment
127127
description: The pipeline will fail after ${{WAIT_ON_FAIL}} minutes
128128
timeout:
129129
timeUnit: minutes
@@ -133,20 +133,11 @@ steps:
133133
condition:
134134
all:
135135
error: '"${{FAILED}}" == "failed"'
136-
wait_on_fail: ${{WAIT_ON_FAIL}}
137-
dummy_end:
138-
title: "Dummy step"
139-
description: Without this, the on_finish hook is executed before the approval step
140-
image: python:3.9.10
141-
stage: qa
142-
when:
143-
condition:
144-
all:
145-
error: '"${{FAILED}}" == "failed"'
146-
wait_on_fail: ${{WAIT_ON_FAIL}}
147-
hooks:
148-
on_finish:
136+
delete_deployment:
137+
title: "Delete deployment"
138+
description: The deployment is deleted at the end of the pipeline
149139
image: codefresh/kubectl
140+
stage: qa
150141
commands:
151142
- kubectl config use-context ${{CLUSTER_NAME}}
152-
- kubectl delete ns test-${{NAMESPACE_BASENAME}}-${{CF_SHORT_REVISION}}
143+
- kubectl delete ns test-${{NAMESPACE_BASENAME}}

deployment/codefresh-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,4 +544,4 @@ steps:
544544
stage: qa
545545
commands:
546546
- kubectl config use-context ${{CLUSTER_NAME}}
547-
- kubectl delete ns test-${{NAMESPACE_BASENAME}}-${{CF_SHORT_REVISION}}
547+
- kubectl delete ns test-${{NAMESPACE_BASENAME}}

0 commit comments

Comments
 (0)