Skip to content

Commit

Permalink
test: wait for IAM role propagation in migration test (#14060)
Browse files Browse the repository at this point in the history
* chore: support FIDO keys in CLI scripts

* test: wait for policy propagation
  • Loading branch information
palpatim authored Jan 8, 2025
1 parent 9ebe990 commit be90f93
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ describe('transformer model migration test', () => {
await updateApiSchema(projRoot, projectName, modelSchemaV2);
await amplifyPushUpdate(projRoot);

// Wait for 20s to ensure the newly-created roles have propagated
await new Promise((resolve) => setTimeout(resolve, 20000));

appSyncClient = getAppSyncClientFromProj(projRoot);

createPostMutation = /* GraphQL */ `
Expand Down
6 changes: 5 additions & 1 deletion scripts/cloud-cli-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ function authenticate {
role_name=$2
profile_name=$3
echo Authenticating terminal...
mwinit
if [[ -n $USE_FIDO_KEY ]] ; then
mwinit -s -f
else
mwinit
fi
echo Loading account credentials for Account $account_number with Role: $role_name...
ada cred update --profile="${profile_name}" --account="${account_number}" --role=${role_name} --provider=isengard --once
aws configure set region us-east-1 --profile $profile_name
Expand Down
7 changes: 6 additions & 1 deletion scripts/cloud-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ source $scriptDir/.env set
printf 'What is your PR number ? '
read PR_NUMBER

mwinit
if [[ -n $USE_FIDO_KEY ]] ; then
mwinit -s -f
else
mwinit
fi

ada cred update --profile=cb-ci-account --account=$E2E_ACCOUNT_PROD --role=CodeBuildE2E --provider=isengard --once
RESULT=$(aws codebuild start-build-batch \
--profile=cb-ci-account \
Expand Down
7 changes: 6 additions & 1 deletion scripts/cloud-rollback.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ source $scriptDir/.env set
printf 'What version should I rollback to ? '
read ROLLBACK_TARGET_VERSION

mwinit
if [[ -n $USE_FIDO_KEY ]] ; then
mwinit -s -f
else
mwinit
fi

ada cred update --profile=AmplifyCLIReleaseProd --account=$RELEASE_ACCOUNT_PROD --role=CodebuildRelease --provider=isengard --once
RESULT=$(aws codebuild start-build-batch \
--profile=AmplifyCLIReleaseProd \
Expand Down

0 comments on commit be90f93

Please sign in to comment.