Skip to content

Commit

Permalink
feat(oci): add login to generic repositories
Browse files Browse the repository at this point in the history
aka : dockerhub for example, or any private registry
  • Loading branch information
ulrich-giraud committed Sep 16, 2024
1 parent 6650fc1 commit 086e227
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions assets/out
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ fi

helm_registry_login() {
ecr=$(jq -r '.params.private_registry|has("ecr")' < $payload)
generic=$(jq -r '.params.private_registry|has("generic")' < $payload)
if [ "${ecr}" = true ]; then
region=$(jq -r '.params.private_registry.ecr.region // ""' < $payload)
account_id=$(jq -r '.params.private_registry.ecr.account_id // ""' < $payload)
Expand Down Expand Up @@ -153,6 +154,12 @@ helm_registry_login() {
aws ecr get-login-password --region ${region} ${profile_opt} | helm registry login --username AWS --password-stdin ${account_id}.dkr.ecr.${region}.amazonaws.com
fi
echo "done logging in to ECR"
elif [ "${generic}" = true ]; then
registry_host=$(jq -r '.params.private_registry.generic.host // ""' < $payload)
registry_username=$(jq -r '.params.private_registry.generic.username // ""' < $payload)
registry_password=$(jq -r '.params.private_registry.generic.password // ""' < $payload)
echo "$registry_password" | helm registry login $registry_host --username $registry_username --password-stdin
echo "done logging in to generic registry"
else
# implement support for other helm registry following a similar pattern
echo "unsupported private reigistry configuration"
Expand Down

0 comments on commit 086e227

Please sign in to comment.