Skip to content

Commit be13268

Browse files
committed
Download controller-gen when building book
This downloads controller-gen when building the book, so that the markerdocs plugin can run. This also updates to the live version of mdbook.
1 parent d604f5a commit be13268

File tree

1 file changed

+46
-3
lines changed

1 file changed

+46
-3
lines changed

docs/book/install-and-build.sh

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,54 @@
11
#!/bin/bash
22

3+
set -e
4+
35
os=$(go env GOOS)
46
arch=$(go env GOARCH)
57

8+
# translate arch to rust's conventions (if we can)
9+
if [[ ${arch} == "amd64" ]]; then
10+
arch="x86_64"
11+
elif [[ ${arch} == "x86" ]]; then
12+
arch="i686"
13+
fi
14+
15+
# translate os to rust's conventions (if we can)
16+
ext="tar.gz"
17+
cmd="tar -C /tmp -xzvf"
18+
case ${os} in
19+
windows)
20+
target="pc-windows-msvc"
21+
ext="zip"
22+
cmd="unzip -d /tmp"
23+
;;
24+
darwin)
25+
target="apple-darwin"
26+
;;
27+
linux)
28+
# works for linux, too
29+
target="unknown-${os}-gnu"
30+
;;
31+
*)
32+
target="unknown-${os}"
33+
;;
34+
esac
35+
636
# grab mdbook
7-
# mdbook's deploy got borked by a CI move, so grab our build till that gets
8-
# fixed (https://github.com/rust-lang-nursery/mdBook/issues/904).
9-
curl -sL -o /tmp/mdbook https://storage.googleapis.com/kubebuilder-build-tools/mdbook-0.2.3-${os}-${arch}
37+
# we hardcode linux/amd64 since rust uses a different naming scheme and it's a pain to tran
38+
echo "downloading mdBook-v0.3.1-${arch}-${target}.${ext}"
39+
set -x
40+
curl -sL -o /tmp/mdbook.${ext} https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.1/mdBook-v0.3.1-${arch}-${target}.${ext}
41+
${cmd} /tmp/mdbook.${ext}
1042
chmod +x /tmp/mdbook
43+
44+
echo "grabbing the latest released controller-gen"
45+
# TODO(directxman12): remove the @v0.2.0-beta.4 once get v0.2.0 released,
46+
# so that we actually get the latest version
47+
go get sigs.k8s.io/controller-tools/cmd/[email protected]
48+
49+
# make sure we add the go bin directory to our path
50+
gobin=$(go env GOBIN)
51+
gobin=${GOBIN:-$(go env GOPATH)/bin} # GOBIN won't always be set :-/
52+
53+
export PATH=${gobin}:$PATH
1154
/tmp/mdbook build

0 commit comments

Comments
 (0)