From c1031d7a177010b62b67d36b23822d8c775f6707 Mon Sep 17 00:00:00 2001 From: Adam Mendlik Date: Tue, 19 Nov 2024 07:47:46 -0700 Subject: [PATCH] Allow deployments using SSO profiles The previous logic verified that a profile exists by looking for the configuration value `aws_access_key_id`. This value only exists for for profiles with API keys, so it fails for SSO authenticated profiles. This commit uses the more generic `aws configure list` command to verify that the profile exists. The command returns 0 if the profile is present, and 255 if it is not. --- source/bin/URL.sh | 2 +- source/bin/update-public.sh | 2 +- source/bin/upload.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/bin/URL.sh b/source/bin/URL.sh index a1be03a1..4d4deec3 100755 --- a/source/bin/URL.sh +++ b/source/bin/URL.sh @@ -2,7 +2,7 @@ __dirname="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" export AWS_PROFILE=$(node -e "console.log(require('$__dirname'+'/../config.json').profile)") # If profile specified from config file does not exist, allow cli to move on to using instance profile -aws configure get aws_access_key_id --profile $AWS_PROFILE || unset AWS_PROFILE +aws configure list --profile $AWS_PROFILE || unset AWS_PROFILE export AWS_DEFAULT_REGION=$(node -e "console.log(require('$__dirname'+'/../config.json').region)") OUTPUT=$($__dirname/exports.js dev/bootstrap) diff --git a/source/bin/update-public.sh b/source/bin/update-public.sh index 661f0fea..caadf3e6 100755 --- a/source/bin/update-public.sh +++ b/source/bin/update-public.sh @@ -90,7 +90,7 @@ parse_arguments $@ __dirname="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" export AWS_PROFILE=$(node -e "console.log(require('$__dirname'+'/../config.json').profile)") # If profile specified from config file does not exist, allow cli to move on to using instance profile -aws configure get aws_access_key_id --profile $AWS_PROFILE || unset AWS_PROFILE +aws configure list --profile $AWS_PROFILE || unset AWS_PROFILE export AWS_DEFAULT_REGION=$(node -e "console.log(require('$__dirname'+'/../config.json').region)") OUTPUT=$($__dirname/exports.js dev/bootstrap) diff --git a/source/bin/upload.sh b/source/bin/upload.sh index 07b49d14..6136613b 100755 --- a/source/bin/upload.sh +++ b/source/bin/upload.sh @@ -76,7 +76,7 @@ parse_arguments $@ __dirname="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" export AWS_PROFILE=$(node -e "console.log(require('$__dirname'+'/../config.json').profile)") # If profile specified from config file does not exist, allow cli to move on to using instance profile -aws configure get aws_access_key_id --profile $AWS_PROFILE || unset AWS_PROFILE +aws configure list --profile $AWS_PROFILE || unset AWS_PROFILE export AWS_DEFAULT_REGION=$(node -e "console.log(require('$__dirname'+'/../config.json').region)") OUTPUT=$($__dirname/exports.js dev/bootstrap)