Skip to content

Commit

Permalink
force login to registry
Browse files Browse the repository at this point in the history
  • Loading branch information
skudasov committed Feb 5, 2024
1 parent 0cc2232 commit f626572
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
23 changes: 20 additions & 3 deletions charts/chainlink-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
Expand All @@ -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
Expand Down
10 changes: 9 additions & 1 deletion charts/chainlink-cluster/devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions charts/chainlink-cluster/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
Expand All @@ -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"
Expand All @@ -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"

0 comments on commit f626572

Please sign in to comment.