From f626572a4e3a76e06bcec3d6b6ac5bd861902994 Mon Sep 17 00:00:00 2001 From: skudasov Date: Mon, 5 Feb 2024 03:51:09 +0100 Subject: [PATCH] force login to registry --- charts/chainlink-cluster/README.md | 23 ++++++++++++++++++++--- charts/chainlink-cluster/devspace.yaml | 10 +++++++++- charts/chainlink-cluster/setup.sh | 6 +++--- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/charts/chainlink-cluster/README.md b/charts/chainlink-cluster/README.md index 3deb37794a6..7f2736034a7 100644 --- a/charts/chainlink-cluster/README.md +++ b/charts/chainlink-cluster/README.md @@ -5,6 +5,7 @@ Install `kubefwd` (no nixpkg for it yet, planned) ``` brew install txn2/tap/kubefwd ``` +If you want to build images you need [docker](https://docs.docker.com/engine/install/) service running Enter the shell (from the root project dir) ``` @@ -18,17 +19,33 @@ We are using [devspace](https://www.devspace.sh/docs/getting-started/installatio Configure the cluster, see `deployments.app.helm.values` and [values.yaml](./values.yaml) comments for more details -Enter the shell and deploy +Configure your `cluster` setup (one time setup, internal usage only) +``` +export DEVSPACE_IMAGE="..." +cd charts/chainlink-cluster +./setup.sh ${my-personal-namespace-name-crib} +``` + +Build and deploy current commit ``` -# set your unique namespace if it's a new cluster -devspace use namespace cl-cluster devspace deploy ``` + If you don't need a build use ``` devspace deploy --skip-build ``` +To deploy particular commit (must be in registry) use +``` +devspace deploy --skip-build ${short_sha_of_image} +``` + +Forward ports to check UI or run tests +``` +devspace run connect ${my-personal-namespace-name-crib} +``` + Connect to your environment, by replacing container with label `node-1` with your local repository files ``` devspace dev -p node diff --git a/charts/chainlink-cluster/devspace.yaml b/charts/chainlink-cluster/devspace.yaml index 9a6bce9af94..545923d4124 100644 --- a/charts/chainlink-cluster/devspace.yaml +++ b/charts/chainlink-cluster/devspace.yaml @@ -3,7 +3,9 @@ name: chainlink vars: NS_TTL: 72h - DEVSPACE_IMAGE: 323150190480.dkr.ecr.us-west-2.amazonaws.com/chainlink-devspace + DEVSPACE_IMAGE: + noCache: true + source: env # This is a list of `pipelines` that DevSpace can execute (you can define your own) pipelines: @@ -17,6 +19,12 @@ pipelines: set -o pipefail echo "Removing .devspace cache!" rm -rf .devspace/ || true + registry_id=$(echo "$DEVSPACE_IMAGE" | cut -d'.' -f1) + + # Login into registry + echo "Authorizing into ECR registry" + aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${registry_id}.dkr.ecr.us-west-2.amazonaws.com + run_dependencies --all ensure_pull_secrets --all build_images ---var DOCKER_DEFAULT_PLATFORM=linux/amd64 --all -t $(git rev-parse --short HEAD) diff --git a/charts/chainlink-cluster/setup.sh b/charts/chainlink-cluster/setup.sh index a8b7a7b0f47..536bef57c75 100755 --- a/charts/chainlink-cluster/setup.sh +++ b/charts/chainlink-cluster/setup.sh @@ -4,6 +4,7 @@ set -e user_home="$HOME" file_path="$user_home/.aws/config" image="" +registry_id=$(echo "$DEVSPACE_IMAGE" | cut -d'.' -f1) if grep -q "staging-crib" "$file_path"; then echo "Staging AWS config is already applied, role is 'staging-crib'" @@ -13,7 +14,7 @@ else region=us-west-2 sso_start_url=https://smartcontract.awsapps.com/start sso_region=us-west-2 -sso_account_id=323150190480 +sso_account_id=${registry_id} sso_role_name=CRIB-ECR-Power EOF echo "~/.aws/config modified, added 'staging-crib" @@ -32,6 +33,5 @@ else echo "Docker daemon is not running, exiting" exit 1 fi -aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 323150190480.dkr.ecr.us-west-2.amazonaws.com +aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${registry_id}.dkr.ecr.us-west-2.amazonaws.com devspace use namespace $1 -export DEVSPACE_IMAGE="323150190480.dkr.ecr.us-west-2.amazonaws.com/chainlink-devspace"