Skip to content

Commit 71c0761

Browse files
Create test.yaml
1 parent 55363fc commit 71c0761

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: '1.0'
2+
3+
steps:
4+
5+
wait:
6+
image: codefresh/cli
7+
commands:
8+
# Get CF pipeline name programaticlly
9+
- CF_PIPELINE_NAME=$(codefresh get builds ${{CF_BUILD_ID}}|awk '{print $2}'|egrep -v "PIPELINE-NAME|no available")
10+
# Verify if there's already another running build, if so, terminate it
11+
- while [ $(codefresh get builds --status=running --pipeline-name=$CF_PIPELINE_NAME -b ${{CF_BRANCH}} |egrep -v "ID|no available"| wc -l) -gt 1 -a $(codefresh get builds --status=running --pipeline-name=$CF_PIPELINE_NAME -b ${{CF_BRANCH}}|egrep -v "ID|no available"|awk 'NR==1{print $1}') = ${{CF_BUILD_ID}} ]; do TERMINATE_BUILD=$(codefresh get builds --status=running --pipeline-name=$CF_PIPELINE_NAME -b ${{CF_BRANCH}}|egrep -v "ID|no available"|awk 'NR==2{print $1}') && echo "terminating build $TERMINATE_BUILD" && codefresh terminate $TERMINATE_BUILD && sleep 5; done
12+
sleep:
13+
image: alpine
14+
commands:
15+
- sleep 60

0 commit comments

Comments
 (0)