Skip to content

Commit d0a160d

Browse files
authored
Early exit if build failed (#317)
1 parent 08ec5b0 commit d0a160d

File tree

1 file changed

+26
-42
lines changed

1 file changed

+26
-42
lines changed

.circleci/config.yml

Lines changed: 26 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,26 @@ commands:
110110
name: "Wait for IPFS daemon to start"
111111
command: wget --output-document - --retry-connrefused --waitretry=20 --read-timeout=20 --timeout=15 -t 10 --post-data '' "http://localhost:5001/api/v0/version"
112112

113+
wait-for-cannon-build:
114+
steps:
115+
- run:
116+
name: "Wait for cannon to complete the build"
117+
command: |
118+
touch ./cannon-build.log
119+
# If the information wasn't found, start tailing the log
120+
if ! grep -q 'The local node will continue running at' ./cannon-build.log; then
121+
while IFS= read -r line
122+
do
123+
echo $line
124+
if [[ $line == *"The local node will continue running at"* ]]; then
125+
break
126+
fi
127+
if [[ $line == *"An error occured during build"* ]]; then
128+
exit 1
129+
fi
130+
done < <(tail -f -n0 ./cannon-build.log)
131+
fi
132+
113133
github-pr:
114134
parameters:
115135
working_directory:
@@ -255,21 +275,9 @@ jobs:
255275
--upgrade-from << parameters.package >>@<< parameters.preset >> \
256276
--chain-id << parameters.chain-id >> \
257277
--provider-url << parameters.provider-url >> \
258-
| tee ./cannon-build.log
278+
2>&1 | tee ./cannon-build.log
259279
260-
- run:
261-
name: "Wait for cannon to complete the build"
262-
command: |
263-
touch ./cannon-build.log
264-
# If the information wasn't found, start tailing the log
265-
if ! grep -q 'The local node will continue running at' ./cannon-build.log; then
266-
while IFS= read -r line
267-
do
268-
if [[ $line == *"The local node will continue running at"* ]]; then
269-
break
270-
fi
271-
done < <(tail -f -n0 ./cannon-build.log)
272-
fi
280+
- wait-for-cannon-build
273281

274282
- store_artifacts:
275283
path: "./cannon-build.log"
@@ -361,21 +369,9 @@ jobs:
361369
--dry-run \
362370
--chain-id << parameters.chain-id >> \
363371
--provider-url << parameters.provider-url >> \
364-
| tee ./cannon-build.log
372+
2>&1 | tee ./cannon-build.log
365373
366-
- run:
367-
name: "Wait for cannon to complete the build"
368-
command: |
369-
touch ./cannon-build.log
370-
# If the information wasn't found, start tailing the log
371-
if ! grep -q 'The local node will continue running at' ./cannon-build.log; then
372-
while IFS= read -r line
373-
do
374-
if [[ $line == *"The local node will continue running at"* ]]; then
375-
break
376-
fi
377-
done < <(tail -f -n0 ./cannon-build.log)
378-
fi
374+
- wait-for-cannon-build
379375

380376
- store_artifacts:
381377
path: "./cannon-build.log"
@@ -661,21 +657,9 @@ jobs:
661657
--upgrade-from << parameters.package >>@<< parameters.preset >> \
662658
--chain-id << parameters.chain-id >> \
663659
--provider-url << parameters.provider-url >> \
664-
| tee ./cannon-build.log
660+
2>&1 | tee ./cannon-build.log
665661
666-
- run:
667-
name: "Wait for cannon to complete the build"
668-
command: |
669-
touch ./cannon-build.log
670-
# If the information wasn't found, start tailing the log
671-
if ! grep -q 'The local node will continue running at' ./cannon-build.log; then
672-
while IFS= read -r line
673-
do
674-
if [[ $line == *"The local node will continue running at"* ]]; then
675-
break
676-
fi
677-
done < <(tail -f -n0 ./cannon-build.log)
678-
fi
662+
- wait-for-cannon-build
679663

680664
- store_artifacts:
681665
path: "./cannon-build.log"

0 commit comments

Comments
 (0)