Merge pull request #219 from pivotal-k8s/master
Make build.sh work for windows plugins.
This commit is contained in:
commit
073df9a04d
@ -29,7 +29,7 @@ script:
|
||||
if [ "${TARGET}" == "amd64" ]; then
|
||||
GOARCH="${TARGET}" ./test.sh
|
||||
else
|
||||
GOARCH="${TARGET}" ./build.sh
|
||||
GOARCH="${TARGET}" ./build_linux.sh
|
||||
fi
|
||||
|
||||
notifications:
|
||||
|
@ -31,8 +31,8 @@ are very busy and read the mailing lists.
|
||||
|
||||
## Building
|
||||
|
||||
Each plugin is compiled simply with `go build`. A script, `build.sh`,
|
||||
is supplied which will build all the plugins in the repo.
|
||||
Each plugin is compiled simply with `go build`. Two scripts, `build_linux.sh` and `build_windows.sh`,
|
||||
are supplied which will build all the plugins for their respective OS.
|
||||
|
||||
## Contribution workflow
|
||||
|
||||
|
@ -24,15 +24,9 @@ PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/sample"
|
||||
for d in $PLUGINS; do
|
||||
if [ -d "$d" ]; then
|
||||
plugin="$(basename "$d")"
|
||||
if [ $plugin == "windows" ]
|
||||
then
|
||||
if [ "$GOARCH" == "amd64" ]
|
||||
then
|
||||
GOOS=windows . $d/build.sh
|
||||
fi
|
||||
else
|
||||
if [ $plugin != "windows" ]; then
|
||||
echo " $plugin"
|
||||
$GO build -o "${PWD}/bin/$plugin" "$@" "$REPO_PATH"/$d
|
||||
$GO build -o "${PWD}/bin/$plugin" "$@" "$REPO_PATH"/$d
|
||||
fi
|
||||
fi
|
||||
done
|
24
build_windows.sh
Executable file
24
build_windows.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd $(dirname "$0")
|
||||
|
||||
ORG_PATH="github.com/containernetworking"
|
||||
export REPO_PATH="${ORG_PATH}/plugins"
|
||||
|
||||
if [ ! -h gopath/src/${REPO_PATH} ]; then
|
||||
mkdir -p gopath/src/${ORG_PATH}
|
||||
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
|
||||
fi
|
||||
|
||||
export GOPATH=${PWD}/gopath
|
||||
export GO="${GO:-go}"
|
||||
export GOOS=windows
|
||||
|
||||
PLUGINS=$(cat plugins/windows_only.txt)
|
||||
for d in $PLUGINS; do
|
||||
if [ -d "$d" ]; then
|
||||
plugin="$(basename "$d").exe"
|
||||
echo " $plugin"
|
||||
$GO build -o "${PWD}/bin/$plugin" "$@" "$REPO_PATH"/$d
|
||||
fi
|
||||
done
|
@ -19,15 +19,26 @@ docker run -v ${SRC_DIR}:/go/src/github.com/containernetworking/plugins --rm gol
|
||||
/bin/sh -xe -c "\
|
||||
apk --no-cache add bash tar;
|
||||
cd /go/src/github.com/containernetworking/plugins; umask 0022;
|
||||
|
||||
for arch in amd64 arm arm64 ppc64le s390x; do \
|
||||
rm -f ${OUTPUT_DIR}/*; \
|
||||
CGO_ENABLED=0 GOARCH=\$arch ./build.sh ${BUILDFLAGS}; \
|
||||
CGO_ENABLED=0 GOARCH=\$arch ./build_linux.sh ${BUILDFLAGS}; \
|
||||
for format in tgz; do \
|
||||
FILENAME=cni-plugins-\$arch-${TAG}.\$format; \
|
||||
FILENAME=cni-plugins-linux-\$arch-${TAG}.\$format; \
|
||||
FILEPATH=${RELEASE_DIR}/\$FILENAME; \
|
||||
tar -C ${OUTPUT_DIR} --owner=0 --group=0 -caf \$FILEPATH .; \
|
||||
done; \
|
||||
done;
|
||||
|
||||
rm -rf ${OUTPUT_DIR}/*; \
|
||||
CGO_ENABLED=0 GOARCH=amd64 ./build_windows.sh ${BUILDFLAGS}; \
|
||||
for format in tgz; do \
|
||||
FILENAME=cni-plugins-windows-amd64-${TAG}.\$format; \
|
||||
FILEPATH=${RELEASE_DIR}/\$FILENAME; \
|
||||
tar -C ${OUTPUT_DIR} --owner=0 --group=0 -caf \$FILEPATH .; \
|
||||
done;
|
||||
|
||||
|
||||
cd ${RELEASE_DIR};
|
||||
for f in *.tgz; do sha1sum \$f > \$f.sha1; done;
|
||||
for f in *.tgz; do sha256sum \$f > \$f.sha256; done;
|
||||
|
Loading…
x
Reference in New Issue
Block a user