-
Notifications
You must be signed in to change notification settings - Fork 83
Description
Scaffold.js is a re-implementation of these 2 bash scripts:
- https://github.com/netlify/buildbot/blob/master/script/run-build.sh
- ^ ran by run-build.sh https://github.com/netlify/build-image/blob/xenial/run-build-functions.sh
This bash script is responsible for the "magic" of the build image where you give it a repo and it just works ™
Under the hood it's:
- Creating directories in the build image
- Fetching caches dependancies & binaries from previous runs
- Installing various versions of runtimes
- Installing static site generator dependancies
- Running the
build.cmd(will be taken over by @netlify/build) - Saves the dependancies etc to cache for next run.
run-build.sh and https://github.com/netlify/netlify-build/blob/master/packages/%40netlify-build/src/scaffold.js have this logic.
We need to get the new node package working inside the https://github.com/netlify/build-image so we can continue iterating on it and eventually replace the giant bash script with maintainable node script.
I was able to get it running locally in docker, but there are some pieces that are missing in Ruby/Go installers.
docker run -it -v $PWD:/netlify/src netlify/build /bin/bash
There are also many places we can optimize this script and run things concurrently instead of everything synchronously one after the other.
TLDR;
- Get scaffold running in https://github.com/netlify/build-image
- Refactor code for concurrency
- Add tests to verify cache fetched correctly, dependancies installed correctly, etc.
Note: this won't run locally on a users machine, only in a CI context in a docker image. This is due to the fact it does a lot of changes to binaries, deps, etc. and we don't want to break anyone's computer 😃