| 1 |
#!/bin/bash |
| 2 |
set -eux |
| 3 |
|
| 4 |
# apply patches |
| 5 |
dpkg-source --before-build . |
| 6 |
|
| 7 |
# prepare the environment |
| 8 |
./debian/rules dh_configure |
| 9 |
export GOPATH="$PWD/_build" |
| 10 |
export DOCKER_GITCOMMIT="$(./debian/helpers/gitcommit.sh)" |
| 11 |
|
| 12 |
# docker's tests need an unprivileged user available at this username |
| 13 |
useradd --system --gid docker --comment 'Docker Test Suite Unprivileged User' unprivilegeduser |
| 14 |
|
| 15 |
# https://github.com/docker/docker/blob/7307998a44237a8943792c279b81ff5a387a86fa/builder/dockerfile/builder.go#L34-L44 |
| 16 |
proxyArgs=( |
| 17 |
http_proxy |
| 18 |
https_proxy |
| 19 |
ftp_proxy |
| 20 |
no_proxy |
| 21 |
) |
| 22 |
DOCKER_BUILD_ARGS= |
| 23 |
for proxyArgBase in "${proxyArgs[@]}"; do |
| 24 |
for proxyArg in "${proxyArgBase^^}" "$proxyArgBase"; do |
| 25 |
if [ -n "${!proxyArg}" ]; then |
| 26 |
[ -z "$DOCKER_BUILD_ARGS" ] || DOCKER_BUILD_ARGS+=' ' |
| 27 |
DOCKER_BUILD_ARGS+="--build-arg ${proxyArg}=${!proxyArg}" |
| 28 |
fi |
| 29 |
done |
| 30 |
done |
| 31 |
export DOCKER_BUILD_ARGS |
| 32 |
|
| 33 |
# run the tests |
| 34 |
./hack/make.sh test-integration-cli |
| 35 |
|
| 36 |
# clean up cruft we've created |
| 37 |
./debian/rules clean |
| 38 |
userdel --force unprivilegeduser |
| 39 |
|
| 40 |
# unapply patches |
| 41 |
dpkg-source --after-build . |