[match][spaceship] Fixed matchfile overriding fastfile team_id with bonus spaceship select_team additions #12235
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #12146
Starting implementation of #12234 (see this issue for more details and examples)
Issue
Using action options
verify_block
can have some unintended side effects that will break the rules of Priorities of parameters and optionsExample of how this happens
This is mainly a problem when
load_configuration_file
is called outside of standard action loading process -fastlane/fastlane/lib/fastlane/actions/sync_code_signing.rb
Lines 7 to 16 in 055f325
In
match
's case above, it will load...Fastfile
parameter (this is correct)Matchfile
parameter but doesn't becauseFastfile
parameter setmatch
's run, this extraload_configuration_file
will attempt to load files fromMatchfile
again (and won't override theFastfile
value) but theverify_block
method gets called and setsENV["FASTLANE_TEAM_ID"]
to a potentially different team id (if theMatchfile
value is different than theFastfile
value) which will cause a different value to be shown inmatch
's summary than what actually get's used byspaceship
Solution
verify_block
should not be used to set environment variablesverify_block
can actually get called multiple times and should really only be used for verifying a value (not setting it)FASTLANE_TEAM_ID
,FASTLANE_TEAM_NAME
,FASTLANE_ITC_TEAM_ID
, andFASTLANE_ITC_TEAM_NAME
for to use with thespaceship
'sselect_team
methodselect_team
should take a parameter forteam_id
andteam_name
when explicitly looking for a team instead of setting a global environment variable that may potentially get overridden