Skip to content

Commit

Permalink
ci: canaries - improve retry command
Browse files Browse the repository at this point in the history
  • Loading branch information
iartemiev committed Jun 15, 2022
1 parent 88b6a1e commit 3321cc3
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,10 @@ orbs:
label:
description: Display name
type: string
pre-command:
description: This command will not be retried
type: string
default: ''
command:
description: Command to run
type: string
Expand All @@ -1761,16 +1765,18 @@ orbs:
n=0
until [ $n -ge $MAX_RETRY ]
do
"$@" && break
bash -c "$@" && exit 0
n=$[$n+1]
echo "retry $n of $MAX_RETRY"
sleep << parameters.sleep >>
done
if [ $n -ge $MAX_RETRY ]; then
echo "failed: ${@}" >&2
exit 1
fi
}
retry << parameters.command >>
eval << parameters.pre-command >>
retry "<< parameters.command >>"
no_output_timeout: << parameters.no_output_timeout >>

jobs:
Expand Down Expand Up @@ -1802,13 +1808,14 @@ orbs:
steps:
- run-with-retry:
label: Scaffold App
command: cd ../ && npx -y << parameters.npx-command >> amplify-getting-started-<< parameters.framework >> << parameters.npx-post >>
pre-command: cd ../
command: npx -y << parameters.npx-command >> amplify-getting-started-<< parameters.framework >> << parameters.npx-post >>
no_output_timeout: 2m
- run-with-retry:
label: Install AmplifyJS
command: npm i -S aws-amplify && npm i -g wait-on serve
- run-with-retry:
label: Call Amplify library in code
- run:
name: Call Amplify library in code
command: |
echo "$IMPORT_STATEMENT" | cat - << parameters.main-file-path >> | tee << parameters.main-file-path >>
echo "$LIBRARY_STATEMENT" >> << parameters.main-file-path >>
Expand All @@ -1826,7 +1833,7 @@ orbs:
steps:
- run-with-retry:
label: Run in Prod Mode
command: npm run build && (npm start & wait-on http://localhost:3000 -t $MAX_WAIT_ON_TIMEOUT)
command: npm run build && (npm start & wait-on http://localhost:3000 -t $MAX_WAIT_ON_TIMEOUT)

rn-ios:
parameters:
Expand All @@ -1850,16 +1857,17 @@ orbs:
steps:
- run-with-retry:
label: Scaffold App
command: cd ../ && rm -rf amplify_getting_started_<< parameters.framework >> && npx react-native@<< parameters.tag >> init amplify_getting_started_<< parameters.framework >>
pre-command: cd ../ && rm -rf amplify_getting_started_<< parameters.framework >>
command: npx react-native@<< parameters.tag >> init amplify_getting_started_<< parameters.framework >>
no_output_timeout: 10m
- run-with-retry:
label: Install Amplify dependencies
command: npm install aws-amplify aws-amplify-react-native amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage @react-native-picker/picker
- run-with-retry:
label: Pod Install
command: npx pod-install
- run-with-retry:
label: Call Amplify library in code
- run:
name: Call Amplify library in code
command: |
echo "$IMPORT_STATEMENT" | cat - << parameters.main-file-path >> | tee << parameters.main-file-path >>
echo "$LIBRARY_STATEMENT" >> << parameters.main-file-path >>
Expand Down Expand Up @@ -1901,13 +1909,14 @@ orbs:
shasum | awk '{print $1}' > /tmp/gradle_cache_seed
- run-with-retry:
label: Scaffold App
command: cd ../ && rm -rf amplify_getting_started_<< parameters.framework >> && npx react-native@<< parameters.tag >> init amplify_getting_started_<< parameters.framework >>
pre-command: cd ../ && rm -rf amplify_getting_started_<< parameters.framework >>
command: npx react-native@<< parameters.tag >> init amplify_getting_started_<< parameters.framework >>
no_output_timeout: 10m
- run-with-retry:
label: Install Amplify dependencies
command: npm install aws-amplify aws-amplify-react-native amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage @react-native-picker/picker
- run-with-retry:
label: Call Amplify library in code
- run:
name: Call Amplify library in code
command: |
echo "$IMPORT_STATEMENT" | cat - << parameters.main-file-path >> | tee << parameters.main-file-path >>
echo "$LIBRARY_STATEMENT" >> << parameters.main-file-path >>
Expand Down

0 comments on commit 3321cc3

Please sign in to comment.