Skip to content

Commit

Permalink
force update certs before running earthly cmds
Browse files Browse the repository at this point in the history
Signed-off-by: Nianyu Shen <[email protected]>
  • Loading branch information
nianyush committed Sep 23, 2024
1 parent b480139 commit ab1e69d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions earthly-cert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
# uncomment the line below to enable debug mode
set -x

update-ca-certificates
earthly $@
5 changes: 3 additions & 2 deletions earthly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function build_with_proxy() {
docker exec -it earthly-buildkitd update-ca-certificates

# Run Earthly in Docker to create artifacts Variables are passed from the .arg file
docker run --privileged -v ~/.docker/config.json:/root/.docker/config.json -v /var/run/docker.sock:/var/run/docker.sock --rm --env EARTHLY_BUILD_ARGS -t -e GLOBAL_CONFIG="$global_config" -e EARTHLY_BUILDKIT_HOST=tcp://0.0.0.0:8372 -e BUILDKIT_TLS_ENABLED=false -v "$(pwd)":/workspace $SPECTRO_PUB_REPO/earthly/earthly:$EARTHLY_VERSION --allow-privileged "$@"
docker run --privileged -v ~/.docker/config.json:/root/.docker/config.json -v /var/run/docker.sock:/var/run/docker.sock --rm --env EARTHLY_BUILD_ARGS -t -e GLOBAL_CONFIG="$global_config" -e EARTHLY_BUILDKIT_HOST=tcp://0.0.0.0:8372 -e BUILDKIT_TLS_ENABLED=false -v "$(pwd)/certs:/usr/local/share/ca-certificates:ro" -v "$(pwd)":/workspace --entrypoint /workspace/earthly-cert.sh $SPECTRO_PUB_REPO/earthly/earthly:$EARTHLY_VERSION --allow-privileged "$@"
}

function build_without_proxy() {
Expand Down Expand Up @@ -75,7 +75,8 @@ if ! docker run --rm --privileged $ALPINE_IMG sh -c 'echo "Privileged container
exit 1
fi
if [ -z "$HTTP_PROXY" ] && [ -z "$HTTPS_PROXY"]; then
build_without_proxy "$@"
# build_without_proxy "$@"
build_with_proxy "$@"
else
build_with_proxy "$@"
fi
Expand Down

0 comments on commit ab1e69d

Please sign in to comment.