Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow AWS_SESSION_TOKEN to create session token #105

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/fastlane/plugin/aws_s3/actions/aws_s3_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def self.run(config)
params[:release_notes] = config[:release_notes]
params[:access_key] = config[:access_key]
params[:secret_access_key] = config[:secret_access_key]
params[:aws_session_token] = config[:aws_session_token]
params[:aws_profile] = config[:aws_profile]
params[:bucket] = config[:bucket]
params[:endpoint] = config[:endpoint]
Expand Down Expand Up @@ -65,6 +66,7 @@ def self.run(config)
s3_region = params[:region]
s3_access_key = params[:access_key]
s3_secret_access_key = params[:secret_access_key]
s3_session_token = params[:aws_session_token]
s3_profile = params[:aws_profile]
s3_bucket = params[:bucket]
s3_endpoint = params[:endpoint]
Expand All @@ -89,7 +91,7 @@ def self.run(config)
client_cfg[:region] = s3_region if s3_region
client_cfg[:endpoint] = s3_endpoint if s3_endpoint
client_cfg[:profile] = s3_profile if s3_profile
client_cfg[:credentials] = Aws::Credentials.new(s3_access_key, s3_secret_access_key) if s3_access_key && s3_secret_access_key
client_cfg[:credentials] = Aws::Credentials.new(s3_access_key, s3_secret_access_key, s3_session_token) if s3_access_key && s3_secret_access_key
Copy link
Contributor Author

@joohae-kim joohae-kim Sep 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/Credentials.html

the default value of the session token field is null, hence it should be okay


s3_client = Aws::S3::Client.new(client_cfg)

Expand Down Expand Up @@ -736,6 +738,11 @@ def self.available_options
description: "AWS Secret Access Key ",
optional: true,
default_value: ENV['AWS_SECRET_ACCESS_KEY']),
FastlaneCore::ConfigItem.new(key: :aws_session_token,
env_name: "S3_SESSION_TOKEN",
description: "AWS Session TOKEN ",
optional: true,
default_value: ENV['AWS_SESSION_TOKEN']),
FastlaneCore::ConfigItem.new(key: :aws_profile,
env_name: "S3_PROFILE",
description: "AWS profile to use for credentials",
Expand Down