fastlane: Cannot get lane shared values for ios bundleid
Question Checklist
- Updated fastlane to the latest version
- I read the Contribution Guidelines
- I read docs.fastlane.tools
- I searched for existing GitHub issues
Question Subject
Lane SharedValues
Question Description
In short, I am trying to get the following to work
puts Actions.lane_context[SharedValues::SIGH_PROFILE_PATH]
However that prints nothing.
My Match is configured and works fine otherwise. Here is a snippet of Fastfile
match(type: "development", readonly: true)
puts Actions.lane_context[SharedValues::SIGH_PROFILE_PATH]
puts Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]
puts ENV["SIGH_PROFILE_PATH"]
puts ENV["sigh_com.blah.blah_development_profile-name"]
And the output
INFO [2019-02-01 17:08:56.61]: Setting Provisioning Profile type to 'development'
Successfully loaded Appfile at path '/Users/blah/Documents/Xcode Projects/blah-fastlane/fastlane/Appfile'
app_identifier: com.blah.blah
apple_id: blah@blah.com
itc_team_id: XXXX
team_id: ZZZZZ
INFO [2019-02-01 17:08:56.62]:
INFO [2019-02-01 17:08:56.62]: {"com.blah.blah"=>"match Development com.blah.blah"}
INFO [2019-02-01 17:08:56.62]:
INFO [2019-02-01 17:08:56.62]: match Development com.blah.blah
So, as you can see, Match successfully does its thing. What I need is the PROFILE_PATH. I I need the profile_path for the following:
automatic_code_signing( use_automatic_signing: false, team_id: "ZZZZZ", code_sign_identity: "iPhone Developer", profile_name: profile_path_here )
I can get a mapping string. Or I can get profile path if I supply the bundle id in the environment variable ENV[“sigh_com.blah.blah_development_profile-name”], but I don’t want to hardcode the bundle ID anywhere.
Other actions have no problem figuring out the bundle ID, but I can’t get anything to actually output the bundle ID.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 35 (22 by maintainers)
Hey guys 👋 I will jump on it and see what I can do, although I am not very familiar with
matchandsighcode, so it might take a bit 🙂 🙇I am glad proposed solution did work 💪 at the same time I agree - it does not look pretty and would be great to improve it.
One solution might be adding ENV variable
ENV["MATCH_INSTALLED_PROFILE_PATH"]to thematchlane. It is what we basically do inrunner.rb(ENV it is named differently though):https://github.com/fastlane/fastlane/blob/c3e1d4e0a956c655da1dc037f8c34d120707aef0/match/lib/match/runner.rb#L298-L301
The question is if we should add the new ENV variable? I believe it will be clear once we figure out https://github.com/fastlane/fastlane/issues/14255 issue 👍
WDYT guys?
Internet and non-verbal communication… am I right? 😃 @janpio
That’s a great question and something that definitely got confusing for me while studying the documentation
Then I definitely misunderstood your tone - happens sometimes after reading >50 issues from sometimes angry people from the internet 😃 Sorry 🙇♀️
Let’s keep this open, maybe @mollyIV (can think of and) wants to implement a better solution.
This issue here actually triggered a bigger investigation at https://github.com/fastlane/fastlane/issues/14255 into how ENV vars and lane_context are intended to be used. Murky area as we found out, so we invest a bit of time to maybe be able to clean that up.
It does, however just after installing them, it clears the storage by calling
https://github.com/fastlane/fastlane/blob/69c04c5093175ca646e3b91c42107f239bfb5cd9/match/lib/match/runner.rb#L123
Maybe @hydraSlav could simply use an environment variable in that case? According to the code:
https://github.com/fastlane/fastlane/blob/69c04c5093175ca646e3b91c42107f239bfb5cd9/match/lib/match/runner.rb#L290-L293
https://github.com/fastlane/fastlane/blob/69c04c5093175ca646e3b91c42107f239bfb5cd9/match/lib/match/utils.rb#L31
The convention name is
sigh_applicationId_profile-path.@janpio @mollyIV
matchdoes store profiles (and certs) in a remote repo, however it also installs them locally into the default location same as what Xcode uses, i.e/Users/username/Library/MobileDevice/Provisioning Profiles/This below is from running
match(type: "adhoc")Hm, that is very much possible @mollyIV - if
matchonly leaves it in the keychain, it will indeed be difficult. (Semi related: But asmatchshould work on Windows as well, sooner or later there has to be an export option (if there is not already) anyway.)Maybe it is time to take a step back and think about how to solve @hydraSlav 's original problem another way then:
Yep, that is a valid justification.
matchalso already does this, but only partially.Have a look at the unit tests that exist - if you can put new stuff in there, great. In this specific case I think that those ENV vars and shared values are probably not tested for, so the best way to test for them will be to create a lane that reproduces the problem and checks if the value is available after your changes.
Yep, sounds good. If it’s not super easy, feel free to copy paste the “set the value” lines over from one to another. No reason to invest to much time here.
So just go ahead @mollyIV! 🚀
I agree with your first and second point @hydraSlav, but the third suggesting an option is not necessary here. Keep it simple.
Before I start implementing the changes, gonna ask a few follow-up questions 😊
1. Are there any conventions / rules when we should set the values for shared hash?
According to Lane Context documentation:
Wondering whether
matchshould expose the same shared hash values thatsighdoes 🤔 The one way of looking at it is if one lane executes another under the hood, it should expose the same shared hash values. WDYT?2. Testing changes in
matchandsighlanesDo you know what’s the best way to test the changes in those two lanes? Is it adding new unit tests? Or it’s just running and debugging, because unit testing might be quite hard in those cases?
3. Implementation details I’d vote for the solution where we would put all
Actions.lane_context[SharedValues::...]value settings toSigh::Manager.startstatic method 👍 Although we’d need to investigate how many different components are callingSigh::Manager.startas well, and what impact it has.WDYT? 🙇
cc: @janpio , @hydraSlav
So you didn’t learn a new thing for a week now - time to start 😉
Of course it’s fine if you don’t want to jump in, please allow us a bit of time to take care of this. I added the
you can do thistag to the issue, maybe someone else notices and creates a PR.