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

[app store connect] cleanup token creation code across entire project #18186

Merged

Conversation

joshdholtz
Copy link
Member

@joshdholtz joshdholtz commented Feb 12, 2021

Motivation and Context

Adds on to #18173
Partly resolves #18145

Description

  • Commonizes the Spaceship::ConnectAPI::Token creation across entire projects
  • Changed app_store_connect_api_key action
    • Removed SharedValues::APP_STORE_CONNECT_API_KEY
    • Replaced with setting Spaceship::ConnectAPI.token

@google-cla google-cla bot added the cla: yes label Feb 12, 2021
@joshdholtz joshdholtz changed the base branch from master to joshdholtz-new-config-option-for-multiple-env-names February 12, 2021 03:49
@joshdholtz joshdholtz changed the base branch from joshdholtz-new-config-option-for-multiple-env-names to joshdholtz-unified-app-store-connect-api-key-env February 12, 2021 03:50
@@ -2,10 +2,6 @@

module Fastlane
module Actions
module SharedValues
APP_STORE_CONNECT_API_KEY = :APP_STORE_CONNECT_API_KEY
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we really want to break API for users who might depend on this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was unsure about this. I didn’t super want to keep it but I also didn’t want to break 😬 I can put it back in!

@api_token ||= Spaceship::ConnectAPI::Token.create(params[:api_key]) if params[:api_key]
@api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
return @api_token
api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path])
Copy link
Collaborator

Choose a reason for hiding this comment

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

in this class (and a few below) we are not consistent with the way we log about wether we reuse or create a token.

For example the implementation in fastlane/lib/fastlane/actions/set_changelog.rb treats them differently

Copy link
Member Author

Choose a reason for hiding this comment

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

match has a bunch of tools that are only called from the CLI as sub commands. So this one should never really have token to reuse already 🤷‍♂️ But I can make these look and reuse a token if there is an existing one!

Copy link
Member Author

Choose a reason for hiding this comment

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

lol, I read your original comment wrong 😛 I will make this change!

@joshdholtz joshdholtz force-pushed the joshdholtz-unified-app-store-connect-api-key-env branch from 28cf78b to 5b32701 Compare February 17, 2021 17:31
Base automatically changed from joshdholtz-unified-app-store-connect-api-key-env to master February 17, 2021 21:35
@@ -13,7 +13,6 @@ def self.run(params)

begin
Cert.config = params # we alread have the finished config
Cert.config[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
Copy link
Member Author

Choose a reason for hiding this comment

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

Not needed anymore because Cert will look for existing Spaceship::ConnectAPI.client now and use that

@@ -10,7 +10,6 @@ def self.run(params)
require 'match'

params.load_configuration_file("Matchfile")
params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
Copy link
Member Author

Choose a reason for hiding this comment

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

Not needed anymore because Match will look for existing Spaceship::ConnectAPI.client now and use that

Comment on lines 18 to 20
if values[:api_key_path].nil?
values[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
end
Copy link
Member Author

Choose a reason for hiding this comment

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

Not needed anymore because Pilot will look for existing Spaceship::ConnectAPI.client now and use that

@joshdholtz
Copy link
Member Author

@lacostej I think this is ready for a re-review (finally 😅)

@joshdholtz joshdholtz merged commit b55f811 into master May 22, 2021
@joshdholtz joshdholtz deleted the joshdholtz-cleanup-asc-token-creation-in-each-action branch May 22, 2021 00:05
Copy link

@fastlane-bot fastlane-bot left a comment

Choose a reason for hiding this comment

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

Congratulations! 🎉 This was released as part of fastlane 2.184.0 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants