From 0b70fad9378211494121d8f7e0cf06280ab627c5 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 <6404866+HenryNguyen5@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:46:00 -0800 Subject: [PATCH 1/2] Get cross platform + goreleaser working for devspace --- charts/chainlink-cluster/devspace.yaml | 27 ++++++++++++++++---------- shell.nix | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/charts/chainlink-cluster/devspace.yaml b/charts/chainlink-cluster/devspace.yaml index 54ee97db4da..33f4c61fe5b 100644 --- a/charts/chainlink-cluster/devspace.yaml +++ b/charts/chainlink-cluster/devspace.yaml @@ -36,18 +36,25 @@ pipelines: run_dependencies --all ensure_pull_secrets --all - build_images ---var DOCKER_DEFAULT_PLATFORM=linux/amd64 --all -t $(git rev-parse --short HEAD) + + # build_images ---var DOCKER_DEFAULT_PLATFORM=linux/amd64 --all -t $(git rev-parse --short HEAD) + TOPLEVEL=$(git rev-parse --show-toplevel) + pushd $TOPLEVEL + pwd + goreleaser --version + MACOS_SDK_DIR=$(pwd)/tools/bin/MacOSX12.3.sdk ./tools/bin/goreleaser_wrapper release --snapshot --clean --config .goreleaser.develop.yaml + popd + BUILT_IMAGE=$(cat $TOPLEVEL/dist/artifacts.json | jq -r '.[] | select(.type == "Docker Image" and .goarch == "amd64" and (.name | contains("sha")) and ( .name | contains("root") | not) ) | .name') + + echo "Tagging and pushing image" + tag=$(git rev-parse --short HEAD) + TAGGED_IMAGE=${DEVSPACE_IMAGE}:$tag + docker tag $BUILT_IMAGE $TAGGED_IMAGE + docker push $TAGGED_IMAGE + image=$TAGGED_IMAGE + kubectl label namespace ${DEVSPACE_NAMESPACE} cleanup.kyverno.io/ttl=${NS_TTL} || true kubectl label namespace/${DEVSPACE_NAMESPACE} network=crib || true - if [ -n "$1" ]; then - echo "Deploying tag $1" - tag=$1 - image=${DEVSPACE_IMAGE}:$tag - else - echo "Deploying current commit tag: $(git rev-parse --short HEAD)" - tag=$(git rev-parse --short HEAD) - image=${DEVSPACE_IMAGE}:$tag - fi echo "Checking tag: $tag" repository_name="chainlink-devspace" diff --git a/shell.nix b/shell.nix index 44a6b6ab2c1..bc581f8e85a 100644 --- a/shell.nix +++ b/shell.nix @@ -9,7 +9,7 @@ in mkShell { nativeBuildInputs = [ go - + goreleaser postgresql python3 From fa63481012ca090e5f909d39555b3cf168feda16 Mon Sep 17 00:00:00 2001 From: Radek Scheibinger Date: Fri, 1 Mar 2024 18:02:43 +0100 Subject: [PATCH 2/2] move docker build script under custom image build cmd --- charts/chainlink-cluster/devspace.yaml | 42 ++++++++++++++------------ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/charts/chainlink-cluster/devspace.yaml b/charts/chainlink-cluster/devspace.yaml index 33f4c61fe5b..4909d8ffb97 100644 --- a/charts/chainlink-cluster/devspace.yaml +++ b/charts/chainlink-cluster/devspace.yaml @@ -37,26 +37,14 @@ pipelines: run_dependencies --all ensure_pull_secrets --all - # build_images ---var DOCKER_DEFAULT_PLATFORM=linux/amd64 --all -t $(git rev-parse --short HEAD) - TOPLEVEL=$(git rev-parse --show-toplevel) - pushd $TOPLEVEL - pwd - goreleaser --version - MACOS_SDK_DIR=$(pwd)/tools/bin/MacOSX12.3.sdk ./tools/bin/goreleaser_wrapper release --snapshot --clean --config .goreleaser.develop.yaml - popd - BUILT_IMAGE=$(cat $TOPLEVEL/dist/artifacts.json | jq -r '.[] | select(.type == "Docker Image" and .goarch == "amd64" and (.name | contains("sha")) and ( .name | contains("root") | not) ) | .name') - - echo "Tagging and pushing image" - tag=$(git rev-parse --short HEAD) - TAGGED_IMAGE=${DEVSPACE_IMAGE}:$tag - docker tag $BUILT_IMAGE $TAGGED_IMAGE - docker push $TAGGED_IMAGE - image=$TAGGED_IMAGE + build_images --all kubectl label namespace ${DEVSPACE_NAMESPACE} cleanup.kyverno.io/ttl=${NS_TTL} || true kubectl label namespace/${DEVSPACE_NAMESPACE} network=crib || true - echo "Checking tag: $tag" + tag=$(git rev-parse --short HEAD) + image=${DEVSPACE_IMAGE}:$tag + echo "Checking tag: '$tag'" repository_name="chainlink-devspace" desired_tag=$tag @@ -104,11 +92,25 @@ commands: images: app: image: ${DEVSPACE_IMAGE} - dockerfile: ../../core/chainlink.devspace.Dockerfile - context: ../.. - docker: - disableFallback: true + tags: + - $(git rev-parse --short HEAD) + custom: + skipImageArg: true + command: |- + TOPLEVEL=$(git rev-parse --show-toplevel) + pushd $TOPLEVEL + pwd + goreleaser --version + MACOS_SDK_DIR=$(pwd)/tools/bin/MacOSX12.3.sdk ./tools/bin/goreleaser_wrapper release --snapshot --clean --config .goreleaser.develop.yaml + popd + BUILT_IMAGE=$(cat $TOPLEVEL/dist/artifacts.json | jq -r '.[] | select(.type == "Docker Image" and .goarch == "amd64" and (.name | contains("sha")) and ( .name | contains("root") | not) ) | .name') + echo "Tagging and pushing image" + tag=$(git rev-parse --short HEAD) + TAGGED_IMAGE=${DEVSPACE_IMAGE}:$tag + docker tag $BUILT_IMAGE ${runtime.images.app.image}:${runtime.images.app.tag} + echo "Tagged image: $TAGGED_IMAGE" + docker push $TAGGED_IMAGE hooks: - wait: running: true