From a19395caf30d6a34a6205bb1438e7ad922864893 Mon Sep 17 00:00:00 2001 From: Nianyu Shen Date: Thu, 3 Oct 2024 23:12:55 -0700 Subject: [PATCH] update earthly image Signed-off-by: Nianyu Shen --- Earthfile | 15 ++++++++------- earthly.sh | 18 +++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Earthfile b/Earthfile index 8196966..cf37b70 100644 --- a/Earthfile +++ b/Earthfile @@ -2,21 +2,22 @@ VERSION 0.6 ARG TARGETOS ARG TARGETARCH -ARG FIPS_ENABLED=false - # Default image repositories used in the builds. +ARG SPECTRO_PUB_REPO=us-docker.pkg.dev/palette-images +ARG ALPINE_TAG=3.20 +ARG ALPINE_IMG=$SPECTRO_PUB_REPO/edge/canvos/alpine:$ALPINE_TAG +FROM $ALPINE_IMG + +ARG FIPS_ENABLED=false IF [ "$FIPS_ENABLED" = "true" ] - ARG SPECTRO_PUB_REPO=us-docker.pkg.dev/palette-images -ELSE ARG SPECTRO_PUB_REPO=us-docker.pkg.dev/palette-images-fips + ARG ALPINE_IMG=$SPECTRO_PUB_REPO/edge/canvos/alpine:$ALPINE_TAG END ARG SPECTRO_LUET_REPO=$SPECTRO_PUB_REPO/edge ARG KAIROS_BASE_IMAGE_URL=$SPECTRO_PUB_REPO/edge ARG LUET_PROJECT=luet-repo -ARG ALPINE_TAG=3.20 -ARG ALPINE_IMG=$SPECTRO_PUB_REPO/edge/canvos/alpine:$ALPINE_TAG -FROM $ALPINE_IMG + # Spectro Cloud and Kairos tags. ARG PE_VERSION=v4.5.0-rc2 diff --git a/earthly.sh b/earthly.sh index a9ff8a2..325d64b 100755 --- a/earthly.sh +++ b/earthly.sh @@ -11,17 +11,17 @@ function build_with_proxy() { docker stop earthly-buildkitd fi # start earthly buildkitd - docker run -d --privileged --name earthly-buildkitd -v ~/.docker/config.json:/root/.docker/config.json -v /var/run/docker.sock:/var/run/docker.sock --rm -t -e GLOBAL_CONFIG="$global_config" -e BUILDKIT_TCP_TRANSPORT_ENABLED=true -e http_proxy=$HTTP_PROXY -e https_proxy=$HTTPS_PROXY -e HTTPS_PROXY=$HTTPS_PROXY -e HTTP_PROXY=$HTTP_PROXY -e NO_PROXY=$NO_PROXY -e no_proxy=$no_proxy -e EARTHLY_GIT_CONFIG=$gitconfig -v "$PROXY_CERT_PATH:/usr/local/share/ca-certificates/sc.crt:ro" -v earthly-tmp:/tmp/earthly:rw -p 8372:8372 $SPECTRO_PUB_REPO/earthly/buildkitd:$EARTHLY_VERSION + docker run -d --privileged --name earthly-buildkitd -v ~/.docker/config.json:/root/.docker/config.json -v /var/run/docker.sock:/var/run/docker.sock --rm -t -e GLOBAL_CONFIG="$global_config" -e BUILDKIT_TCP_TRANSPORT_ENABLED=true -e http_proxy=$HTTP_PROXY -e https_proxy=$HTTPS_PROXY -e HTTPS_PROXY=$HTTPS_PROXY -e HTTP_PROXY=$HTTP_PROXY -e NO_PROXY=$NO_PROXY -e no_proxy=$no_proxy -e EARTHLY_GIT_CONFIG=$gitconfig -v "$PROXY_CERT_PATH:/usr/local/share/ca-certificates/sc.crt:ro" -v earthly-tmp:/tmp/earthly:rw -p 8372:8372 $SPECTRO_PUB_REPO/third-party/edge/earthly/buildkitd:$EARTHLY_VERSION # Update the CA certificates in the container 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 -v "$PROXY_CERT_PATH:/workspace/sc.crt:ro" $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)":/workspace -v "$PROXY_CERT_PATH:/workspace/sc.crt:ro" $SPECTRO_PUB_REPO/third-party/edge/earthly/earthly:$EARTHLY_VERSION --allow-privileged "$@" } function build_without_proxy() { # 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" -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" -v "$(pwd)":/workspace $SPECTRO_PUB_REPO/third-party/edge/earthly/earthly:$EARTHLY_VERSION --allow-privileged "$@" } function print_os_pack() { @@ -59,10 +59,10 @@ function print_os_pack() { global_config="{disable_analytics: true}" PE_VERSION=$(git describe --abbrev=0 --tags) SPECTRO_PUB_REPO=gcr.io/spectro-images-public -EARTHLY_VERSION=v0.8.5 +EARTHLY_VERSION=v0.8.15 source .arg -ALPINE_IMG=$SPECTRO_PUB_REPO/canvos/alpine:3.20 -### Verify Depencies +ALPINE_IMG=$SPECTRO_PUB_REPO/edge/canvos/alpine:3.20 +### Verify Dependencies # Check if Docker is installed if command -v docker >/dev/null 2>&1; then echo "version: $(docker -v)" @@ -86,18 +86,18 @@ if [ $? -ne 0 ]; then exit 1 fi # Cleanup builder helper images. -docker rmi $SPECTRO_PUB_REPO/earthly/earthly:$EARTHLY_VERSION +docker rmi $SPECTRO_PUB_REPO/third-party/edge/earthly/earthly:$EARTHLY_VERSION if [ "$(docker container inspect -f '{{.State.Running}}' earthly-buildkitd)" = "true" ]; then docker stop earthly-buildkitd fi -docker rmi $SPECTRO_PUB_REPO/earthly/buildkitd:$EARTHLY_VERSION 2>/dev/null +docker rmi $SPECTRO_PUB_REPO/third-party/edge/earthly/buildkitd:$EARTHLY_VERSION 2>/dev/null docker rmi $ALPINE_IMG if [[ "$1" == "+uki-genkey" ]]; then ./keys.sh secure-boot/ fi -# if $1 is in oen of the following values, print the output for use in Palette Profile. +# if $1 is in one of the following values, print the output for use in Palette Profile. targets=("+build-provider-images" "+build-provider-images-fips" "+build-all-images") for arg in "${targets[@]}"; do if [[ "$1" == "$arg" ]]; then