Skip to content

Commit

Permalink
PLT-38: Respect the chart name set by the user.
Browse files Browse the repository at this point in the history
  • Loading branch information
emmeowzing committed Apr 27, 2024
1 parent 065c856 commit 3399b94
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/jobs/helm/release/ecr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ parameters:
description: Executor image to run as.
default: default
type: executor
chart-name:
description: Name of the Helm chart, and also the ECR repository.
default: $CIRCLE_PROJECT_REPONAME
type: string
helm-version:
description: Helm version to install.
type: string
Expand Down Expand Up @@ -107,16 +103,20 @@ steps:
name: Check ECR repository target
command: |+
# If it does not exist, just create it.
if [ -z "$(aws ecr describe-repositories | jq -rMC ".repositories[] | select(.repositoryName == \"<< parameters.chart-name >>\") | .repositoryName")" ]; then
printf "WARNING: Repository \"<< parameters.chart-name >>\" does not exist. Creating.\\n" >&2
# Respect the package name set by the user in the Chart.yaml.
_CHART_NAME="$(yq '.name' << parameters.path >>/Chart.yaml)"
if [ -z "$(aws ecr describe-repositories | jq -rMC ".repositories[] | select(.repositoryName == \"$_CHART_NAME\") | .repositoryName")" ]; then
printf "WARNING: Repository \"$_CHART_NAME\" does not exist. Creating.\\n" >&2
if [ "<< parameters.immutable-repository >>" = "true" ]; then
printf "INFO: Creating image tag immutable repository.\\n"
aws ecr create-repository --repository-name "<< parameters.chart-name >>" --image-tag-mutability IMMUTABLE
aws ecr create-repository --repository-name "$_CHART_NAME" --image-tag-mutability IMMUTABLE
else
aws ecr create-repository --repository-name "<< parameters.chart-name >>" --image-tag-mutability MUTABLE
aws ecr create-repository --repository-name "$_CHART_NAME" --image-tag-mutability MUTABLE
fi
else
printf "INFO: Repository \"<< parameters.chart-name >>\" already exists.\\n"
printf "INFO: Repository \"$_CHART_NAME\" already exists.\\n"
fi
- unless:
condition:
Expand Down

0 comments on commit 3399b94

Please sign in to comment.