Skip to content

Commit 95a4b32

Browse files
Publish helm chart to OCI registry for PR patches
1 parent e885549 commit 95a4b32

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.evergreen.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,16 @@ tasks:
445445
- func: helm_registry_login
446446
- func: publish_helm_chart
447447

448+
- name: publish_helm_chart
449+
commands:
450+
- func: clone
451+
- func: setup_kubectl
452+
- func: setup_aws
453+
- func: prepare_aws
454+
- func: helm_registry_login
455+
- func: python_venv
456+
- func: publish_helm_chart
457+
448458
- name: prepare_aws
449459
priority: 59
450460
commands:

scripts/dev/helm_registry_login.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
ECR_REGISTRY="268558157000.dkr.ecr.us-east-1.amazonaws.com"
4+
AWS_REGION="us-east-1"
5+
6+
source scripts/dev/set_env_context.sh
7+
8+
export PATH=${PROJECT_DIR}/bin:$PATH
9+
10+
echo "Checking if helm CLI is installed..."
11+
if ! command -v helm &> /dev/null
12+
then
13+
echo "Error: helm CLI could not be found."
14+
echo "Please ensure helm is installed and in your system's PATH."
15+
exit 1
16+
fi
17+
18+
echo "Checking if aws CLI is installed..."
19+
if ! command -v aws &> /dev/null
20+
then
21+
echo "Error: aws CLI could not be found."
22+
echo "Please ensure aws CLI is installed and configured."
23+
exit 1
24+
fi
25+
26+
echo "Logging into OCI Registry: ${ECR_REGISTRY} in region ${AWS_REGION}..."
27+
28+
if aws ecr get-login-password --region "$AWS_REGION" | helm registry login \
29+
--username AWS \
30+
--password-stdin \
31+
"$ECR_REGISTRY"
32+
then
33+
echo "Helm successfully logged into the OCI registry."
34+
exit 0
35+
else
36+
echo "ERROR: Helm login to ECR registry failed."
37+
echo "Please ensure your AWS credentials have permission to access ECR in the specified region."
38+
exit 1
39+
fi

0 commit comments

Comments
 (0)