diff --git a/assume-role-arn.sh b/assume-role-arn.sh index 406b26d..666cfd1 100755 --- a/assume-role-arn.sh +++ b/assume-role-arn.sh @@ -32,8 +32,10 @@ fi ASSUME_ROLE_ARN="$ASSUME_ROLE_ARN $*" set -- "$ASSUME_ROLE_ARN" -eval "$ASSUME_ROLE_ARN" +eval "$($ASSUME_ROLE_ARN)" -echo "::set-env name=AWS_ACCESS_KEY_ID::${AWS_ACCESS_KEY_ID}" -echo "::set-env name=AWS_SECRET_ACCESS_KEY::${AWS_SECRET_ACCESS_KEY}" -echo "::set-env name=AWS_SESSION_TOKEN::${AWS_SESSION_TOKEN}" +if [ -n "$AWS_ACCESS_KEY_ID" ]; then + echo "::set-env name=AWS_ACCESS_KEY_ID::${AWS_ACCESS_KEY_ID}" + echo "::set-env name=AWS_SECRET_ACCESS_KEY::${AWS_SECRET_ACCESS_KEY}" + echo "::set-env name=AWS_SESSION_TOKEN::${AWS_SESSION_TOKEN}" +fi diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100755 index 147c51a..0000000 --- a/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -set -e - -cd / - -if [ -z "$AWS_ACCESS_KEY_ID" ]; then - echo "AWS_ACCESS_KEY_ID is not set. Quitting." - exit 1 -fi - -if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then - echo "AWS_SECRET_ACCESS_KEY is not set. Quitting." - exit 1 -fi - - -mkdir -p "${HOME}/.cache" - -eval $(/assume-role-arn $*) - -echo "::set-env name=AWS_ACCESS_KEY_ID::${AWS_ACCESS_KEY_ID}" -echo "::set-env name=AWS_SECRET_ACCESS_KEY::${AWS_SECRET_ACCESS_KEY}" -echo "::set-env name=AWS_SESSION_TOKEN::${AWS_SESSION_TOKEN}"