Skip to content

Commit

Permalink
chore: change default behaviour of buildup (aws#6253)
Browse files Browse the repository at this point in the history
* chore: change default behaviour of buildup

Change the behaviour of the `buildup` script such that resuming a failed
build occurs only when `--resume` flag is passed explicitly. By default,
the script would start the build from the beginning.

Motivation
There are times, that when the script fails, the user has context
switched to something else, or has moved to a different package looking
to fix the error. The user here has to remember to run the script with
the `--restart` flag which is easy to forget, depending on how long it
has been since the failure occurred. Further, when the user forgets to
add the `--restart` flag, it's not clear from the output that he has
made a mistake until much later.

It is a lot more ergonomic, instead, to ask the user to explicitly state
that they intend the build to resume. Further, falling back to
restarting the build when used incorrectly, prefers correctness over
spped. This feels a lot more natural for such a script.

* fail if a flag other than --resume is passed

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
nija-at and mergify[bot] authored Feb 13, 2020
1 parent 44ed2e6 commit 132bfa3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ $ cd packages/@aws-cdk/aws-ec2
$ ../../../scripts/buildup
```

Note that `buildup` uses `foreach.sh`, which means it's resumable. If your build fails and you wish to resume, just run `buildup` again. If you wish to restart, run `buildup --restart`.
Note that `buildup` uses `foreach.sh`, which means it's resumable. If your build fails and you wish to resume, just run
`buildup --resume`. If you wish to restart, run `buildup` again.

### Quick Iteration

Expand Down
12 changes: 8 additions & 4 deletions scripts/buildup
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ scriptdir=$(cd $(dirname $0) && pwd)

echo "************************************************************"
echo " buildup usage:"
echo " - execute 'buildup' again to resume after failure"
echo " - execute 'buildup --restart' to restart"
echo " - execute 'buildup --resume' to resume after failure"
echo " - execute 'buildup' to restart the build from the start"
echo ""
echo " for advanced usage, see ${scriptdir}/foreach.sh"
echo "************************************************************"

if [ "${1:-}" == "--restart" ] || [ "${1:-}" == "--reset" ]; then
if [ "$#" -eq 0 ]; then
${scriptdir}/foreach.sh --reset
else
if [ "$1" != "--resume" ]; then
echo "Unknown option: $1"
exit 1
fi
fi


${scriptdir}/foreach.sh --up yarn build
${scriptdir}/foreach.sh --reset

Expand Down

0 comments on commit 132bfa3

Please sign in to comment.