Skip to content

Commit

Permalink
list buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
ksaifullah committed Apr 24, 2024
1 parent 5373d3b commit ca07479
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ WORKDIR /opt/app

COPY list-bucket.sh .

CMD ["gcloud", "version"]
CMD ["./list-bucket.sh"]
8 changes: 7 additions & 1 deletion list-bucket.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/env bash

gcloud version
AccessToken=$(gcloud auth print-identity-token)
Response=$(aws sts assume-role-with-web-identity --role-arn "${AWS_ROLE_ARN}" --role-session "cloud-guild" --web-identity-token "$AccessToken")
export AWS_ACCESS_KEY_ID=$(echo $Response | jq -r .Credentials.AccessKeyId)
export AWS_SECRET_ACCESS_KEY=$(echo $Response | jq -r .Credentials.SecretAccessKey)
export AWS_SESSION_TOKEN=$(echo $Response | jq -r .Credentials.SessionToken)

aws s3 ls

0 comments on commit ca07479

Please sign in to comment.