Skip to content

Commit

Permalink
chore: switch to us-docker.pkg.dev for image repo (#284)
Browse files Browse the repository at this point in the history
* chore: switch to us-docker.pkg.dev for image repo

Signed-off-by: Nianyu Shen <[email protected]>

* bump providers

Signed-off-by: Nianyu Shen <[email protected]>

* retag

Signed-off-by: Nianyu Shen <[email protected]>

* bump luet and provider version

Signed-off-by: Nianyu Shen <[email protected]>

* update earthly image

Signed-off-by: Nianyu Shen <[email protected]>

* Update Earthfile

update luet-repo version

* Update thirdparty builder

---------

Signed-off-by: Nianyu Shen <[email protected]>
Co-authored-by: Santhosh <[email protected]>
  • Loading branch information
nianyush and santhoshdaivajna authored Oct 4, 2024
1 parent 31105a6 commit d6a2755
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 33 deletions.
56 changes: 32 additions & 24 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,34 @@ ARG TARGETOS
ARG TARGETARCH

# Default image repositories used in the builds.
ARG SPECTRO_PUB_REPO=gcr.io/spectro-images-public
ARG SPECTRO_LUET_REPO=gcr.io/spectro-dev-public
ARG KAIROS_BASE_IMAGE_URL=gcr.io/spectro-images-public
ARG ETCD_REPO=https://github.com/etcd-io
ARG LUET_PROJECT=luet-repo
ARG SPECTRO_PUB_REPO=us-docker.pkg.dev/palette-images
ARG ALPINE_TAG=3.20
ARG ALPINE_IMG=$SPECTRO_PUB_REPO/canvos/alpine:$ALPINE_TAG
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-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


# Spectro Cloud and Kairos tags.
ARG PE_VERSION=v4.4.12
ARG SPECTRO_LUET_VERSION=v1.3.8-alpha2
ARG PE_VERSION=v4.5.0-rc4
ARG SPECTRO_LUET_VERSION=v1.3.8-alpha5
ARG KAIROS_VERSION=v3.1.3
ARG K3S_FLAVOR_TAG=k3s1
ARG RKE2_FLAVOR_TAG=rke2r1
ARG BASE_IMAGE_URL=quay.io/kairos
ARG OSBUILDER_VERSION=v0.300.3
ARG OSBUILDER_IMAGE=quay.io/kairos/osbuilder-tools:$OSBUILDER_VERSION
ARG K3S_PROVIDER_VERSION=v4.5.0-alpha2
ARG KUBEADM_PROVIDER_VERSION=v4.5.0-alpha3
ARG RKE2_PROVIDER_VERSION=v4.4.1
ARG K3S_PROVIDER_VERSION=v4.5.0-alpha3
ARG KUBEADM_PROVIDER_VERSION=v4.5.0-alpha5
ARG RKE2_PROVIDER_VERSION=v4.5.0-alpha1

# Variables used in the builds. Update for ADVANCED use cases only. Modify in .arg file or via CLI arguments.
ARG OS_DISTRIBUTION
Expand All @@ -41,7 +48,7 @@ ARG DISABLE_SELINUX=true
ARG CIS_HARDENING=false
ARG UBUNTU_PRO_KEY

ARG FIPS_ENABLED=false

ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG NO_PROXY
Expand Down Expand Up @@ -100,14 +107,14 @@ END

IF [ "$FIPS_ENABLED" = "true" ]
ARG BIN_TYPE=vertex
ARG STYLUS_BASE=$SPECTRO_PUB_REPO/stylus-framework-fips-linux-$ARCH:$PE_VERSION
ARG STYLUS_PACKAGE_BASE=$SPECTRO_PUB_REPO/stylus-fips-linux-$ARCH:$PE_VERSION
ARG CLI_IMAGE=$SPECTRO_PUB_REPO/palette-edge-cli-fips-${TARGETARCH}:${PE_VERSION}
ARG STYLUS_BASE=$SPECTRO_PUB_REPO/edge/stylus-framework-fips-linux-$ARCH:$PE_VERSION
ARG STYLUS_PACKAGE_BASE=$SPECTRO_PUB_REPO/edge/stylus-fips-linux-$ARCH:$PE_VERSION
ARG CLI_IMAGE=$SPECTRO_PUB_REPO/edge/palette-edge-cli-fips-${TARGETARCH}:${PE_VERSION}
ELSE
ARG BIN_TYPE=palette
ARG STYLUS_BASE=$SPECTRO_PUB_REPO/stylus-framework-linux-$ARCH:$PE_VERSION
ARG STYLUS_PACKAGE_BASE=$SPECTRO_PUB_REPO/stylus-linux-$ARCH:$PE_VERSION
ARG CLI_IMAGE=$SPECTRO_PUB_REPO/palette-edge-cli-${TARGETARCH}:${PE_VERSION}
ARG STYLUS_BASE=$SPECTRO_PUB_REPO/edge/stylus-framework-linux-$ARCH:$PE_VERSION
ARG STYLUS_PACKAGE_BASE=$SPECTRO_PUB_REPO/edge/stylus-linux-$ARCH:$PE_VERSION
ARG CLI_IMAGE=$SPECTRO_PUB_REPO/edge/palette-edge-cli-${TARGETARCH}:${PE_VERSION}
END

IF [ "$CUSTOM_TAG" != "" ]
Expand Down Expand Up @@ -577,15 +584,15 @@ stylus-package-image:

kairos-provider-image:
IF [ "$K8S_DISTRIBUTION" = "kubeadm" ]
ARG PROVIDER_BASE=$SPECTRO_PUB_REPO/kairos-io/provider-kubeadm:$KUBEADM_PROVIDER_VERSION
ARG PROVIDER_BASE=$SPECTRO_PUB_REPO/edge/kairos-io/provider-kubeadm:$KUBEADM_PROVIDER_VERSION
ELSE IF [ "$K8S_DISTRIBUTION" = "kubeadm-fips" ]
ARG PROVIDER_BASE=$SPECTRO_PUB_REPO/kairos-io/provider-kubeadm-fips:$KUBEADM_PROVIDER_VERSION
ARG PROVIDER_BASE=$SPECTRO_PUB_REPO/edge/kairos-io/provider-kubeadm:$KUBEADM_PROVIDER_VERSION
ELSE IF [ "$K8S_DISTRIBUTION" = "k3s" ]
ARG PROVIDER_BASE=$SPECTRO_PUB_REPO/kairos-io/provider-k3s:$K3S_PROVIDER_VERSION
ARG PROVIDER_BASE=$SPECTRO_PUB_REPO/edge/kairos-io/provider-k3s:$K3S_PROVIDER_VERSION
ELSE IF [ "$K8S_DISTRIBUTION" = "rke2" ] && $FIPS_ENABLED
ARG PROVIDER_BASE=$SPECTRO_PUB_REPO/kairos-io/provider-rke2-fips:$RKE2_PROVIDER_VERSION
ARG PROVIDER_BASE=$SPECTRO_PUB_REPO/edge/kairos-io/provider-rke2:$RKE2_PROVIDER_VERSION
ELSE IF [ "$K8S_DISTRIBUTION" = "rke2" ]
ARG PROVIDER_BASE=$SPECTRO_PUB_REPO/kairos-io/provider-rke2:$RKE2_PROVIDER_VERSION
ARG PROVIDER_BASE=$SPECTRO_PUB_REPO/edge/kairos-io/provider-rke2:$RKE2_PROVIDER_VERSION
END
FROM --platform=linux/${ARCH} $PROVIDER_BASE
SAVE ARTIFACT ./*
Expand Down Expand Up @@ -877,7 +884,8 @@ OS_RELEASE:
download-third-party:
ARG TARGETPLATFORM
ARG binary
FROM --platform=$TARGETPLATFORM $SPECTRO_PUB_REPO/builders/spectro-third-party:${BUILDER_3RDPARTY_VERSION}
FROM --platform=$TARGETPLATFORM gcr.io/spectro-images-public/builders/spectro-third-party:${BUILDER_3RDPARTY_VERSION}
#FROM --platform=$TARGETPLATFORM $SPECTRO_PUB_REPO/builders/spectro-third-party:${BUILDER_3RDPARTY_VERSION}
ARG TARGETARCH
SAVE ARTIFACT /binaries/${binary}/latest/$BIN_TYPE/$TARGETARCH/${binary} ${binary}
SAVE ARTIFACT /binaries/${binary}/latest/$BIN_TYPE/$TARGETARCH/${binary}.version ${binary}.version
Expand Down
18 changes: 9 additions & 9 deletions earthly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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)"
Expand All @@ -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
Expand Down

0 comments on commit d6a2755

Please sign in to comment.