Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.sh: Stop at errors and/or unset parameters #99

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
#!/bin/sh
case "$1" in
#!/bin/sh -eu
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get failure on "HTTP_PROXY: unbound variable" when building locally due to the -u flag
Possibly we should remove the proxy build args but either way the -e should be enough I guess

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, my bad. I think keeping the -u but setting ${HTTP_PROXY:-} would be the best way forward. Then we signal that we accept HTTP_PROXY to be empty, but if there are any forgotten variables we will be made aware of it and nothing will go under the radar. I will update.

case "${1:-}" in
armv7hf|aarch64)
;;
*)
# error
echo "Invalid argument '$1', valid arguments are armv7hf or aarch64"
echo "Invalid argument '${1:-}', valid arguments are armv7hf or aarch64"
exit 1
;;
esac

dockerdtag=dockerd:1.0
imagetag="${2:-docker-acap:1.0}"
imagetag=${2:-docker-acap:1.0}
dockerdname=dockerd_name

# First we build and copy out dockerd
docker buildx build --build-arg ACAPARCH="$1" \
--build-arg HTTP_PROXY="$HTTP_PROXY" \
--build-arg HTTPS_PROXY="$HTTPS_PROXY" \
--build-arg HTTP_PROXY="${HTTP_PROXY:-}" \
--build-arg HTTPS_PROXY="${HTTPS_PROXY:-}" \
--tag $dockerdtag \
--no-cache \
--file Dockerfile.dockerd .

docker run -v /var/run/docker.sock:/var/run/docker.sock \
--env HTTP_PROXY="$HTTP_PROXY" \
--env HTTPS_PROXY="$HTTPS_PROXY" \
--env HTTP_PROXY="${HTTP_PROXY:-}" \
--env HTTPS_PROXY="${HTTPS_PROXY:-}" \
--name $dockerdname \
$dockerdtag

Expand All @@ -34,8 +34,8 @@ docker rm $dockerdname

# Now build and copy out the acap
docker buildx build --build-arg ACAPARCH="$1" \
--build-arg HTTP_PROXY="$HTTP_PROXY" \
--build-arg HTTPS_PROXY="$HTTPS_PROXY" \
--build-arg HTTP_PROXY="${HTTP_PROXY:-}" \
--build-arg HTTPS_PROXY="${HTTPS_PROXY:-}" \
--file Dockerfile.acap \
--no-cache \
--tag "$imagetag" .
Expand Down