Rename fast-build to build-cli-bin, fix shasum (#2137)

`fast-build` was performing a full Docker build minus the cli, and then
building cli locally. Separately, shasum was called with a `-p flag,
breaking some builds on Darwin.

Instead, rename `fast-build` to `build-cli-bin`, and restrict it to only
building the cli locally, without any Docker dependencies. Also modify
`bin/linkerd` to call `build-cli-bin` rather than
`docker-build-cli-bin`.

To perform an equivalent of `fast-build`:
`LINKERD_LOCAL_BUILD_CLI=1 bin/docker-build`

`shasum` fix cribbed from #2071.

Relates to #1704

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
This commit is contained in:
Andrew Seigner 2019-01-23 15:25:51 -08:00 committed by GitHub
parent 0d538b7eed
commit b227c85a5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 16 deletions

View File

@ -113,7 +113,7 @@ These commands assume a working
```bash
# build all docker images, using minikube as our docker repo
DOCKER_TRACE=1 bin/mkube bin/fast-build
DOCKER_TRACE=1 bin/mkube bin/docker-build
# install linkerd
bin/linkerd install | kubectl apply -f -
@ -165,12 +165,24 @@ That is equivalent to running `linkerd check` using the code on your branch.
When Linkerd2's CLI is built using `bin/docker-build` it always creates binaries
for all three platforms. For local development and a faster edit-build-test
cycle you might want to avoid that. For those situations you can use the
`bin/fast-build` script, which builds the CLI using the local Go toolchain
cycle you might want to avoid that. For those situations you can set
`LINKERD_LOCAL_BUILD_CLI=1`, which builds the CLI using the local Go toolchain
outside of Docker.
```bash
bin/fast-build
LINKERD_LOCAL_BUILD_CLI=1 bin/docker-build
```
To build only the cli (locally):
```bash
bin/build-cli-bin
```
For repeated cli builds that do not require Go Dep changes:
```bash
LINKERD_SKIP_DEP=1 bin/build-cli-bin
```
### Running the control plane for development
@ -251,11 +263,11 @@ DOCKER_TRACE=1 bin/docker-build-proxy
# Dependencies
## Updating protobuf dependencies
If you make Protobuf changes, run:
```bash
bin/dep ensure
bin/protoc-go.sh
## Updating protobuf dependencies
If you make Protobuf changes, run:
```bash
bin/dep ensure
bin/protoc-go.sh
```
## Updating Docker dependencies
@ -292,15 +304,17 @@ build_architecture
"proxy-init/integration_test/run_tests.sh" -> "proxy-init/integration_test/iptables/Dockerfile-tester";
"_docker.sh" -> "_log.sh";
"_gcp.sh";
"_log.sh";
"_tag.sh";
"_tag.sh" -> "Dockerfile-go-deps";
"linkerd" -> "docker-build-cli-bin";
"build-cli-bin" -> "_tag.sh";
"build-cli-bin" -> "dep";
"build-cli-bin" -> "root-tag";
"dep";
"docker-build" -> "build-cli-bin";
"docker-build" -> "docker-build-cli-bin";
"docker-build" -> "docker-build-controller";
"docker-build" -> "docker-build-grafana";
@ -365,6 +379,10 @@ build_architecture
"go-run" -> ".gorun";
"go-run" -> "root-tag";
"linkerd" -> "build-cli-bin";
"lint";
"minikube-start-hyperv.bat";
"mkube";
@ -388,13 +406,17 @@ build_architecture
".travis.yml" -> "docker-push";
".travis.yml" -> "docker-push-deps";
".travis.yml" -> "docker-retag-all";
".travis.yml" -> "lint";
".travis.yml" -> "protoc-go.sh";
"update-go-deps-shas" -> "_tag.sh";
"update-go-deps-shas" -> "cli/Dockerfile-bin";
"update-go-deps-shas" -> "controller/Dockerfile";
"update-go-deps-shas" -> "grafana/Dockerfile";
"update-go-deps-shas" -> "proxy-init/Dockerfile";
"update-go-deps-shas" -> "web/Dockerfile";
"web" -> "go-run";
}
build_architecture
</details>

View File

@ -8,7 +8,6 @@ bindir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rootdir="$( cd $bindir/.. && pwd )"
. $bindir/_tag.sh
LINKERD_SKIP_CLI_CONTAINER=1 $bindir/docker-build
current_platform=$(uname)
host_platform="windows"
if [ "${current_platform}" = 'Darwin' ]; then

View File

@ -15,9 +15,11 @@ bindir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rootdir="$( cd $bindir/.. && pwd )"
os=linux
dash_p="-p"
exe=
if [ "$(uname -s)" = "Darwin" ]; then
os=darwin
dash_p="" # -p isn't needed on mac
elif [ "$(uname -o)" = "Msys" ]; then
os=windows
exe=.exe
@ -32,7 +34,7 @@ if [ ! -f "$depbin" ]; then
cd "$tmp"
curl -L --silent --fail -o depbin "$depurl"
sha=$(curl -L --silent --fail "${depurl}.sha256" | awk '{ print $1 }')
(echo "$sha *depbin" | shasum -c -a 256 -p -s -) || {
(echo "$sha *depbin" | shasum -c -a 256 $dash_p -s -) || {
echo "Actual digest of $(pwd)/depbin does not match expected digest."
exit 1
}

View File

@ -12,8 +12,10 @@ bindir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$bindir/docker-build-controller
$bindir/docker-build-web
$bindir/docker-build-proxy-init
if [ -z "${LINKERD_SKIP_CLI_CONTAINER:-}" ]; then
if [ -z "${LINKERD_LOCAL_BUILD_CLI:-}" ]; then
$bindir/docker-build-cli-bin
else
$bindir/build-cli-bin
fi
$bindir/docker-build-grafana
$bindir/docker-build-proxy

View File

@ -18,7 +18,7 @@ fi
# build linkerd executable if it does not exist
if [ ! -f $bin ]; then
$bindir/docker-build-cli-bin >/dev/null
$bindir/build-cli-bin >/dev/null
fi
exec $bin "$@"