How to handle multiple iOS targets (widgets) in fastlane - ios

I'm trying to add widgets to our project and fastlane isn't able to automate anymore.
How do I edit the widget bundle identifier in fastlane
How do I set the right provisioning profile for the right target
Things I need:
in xcode the app target should have bundle identifier x.y.z
in xcode the widget target should have the bundle identifier x.y.z.widget
app target
widget target
in xcode the app target should have provisioning profile match adhoc x.y.z
in xcode the widget target should have provisioning profile match adhoc x.y.z.widget
app target signing
widget target signing
current Fastfile lane:
desc "Build the app and send it to Testflight for testing"
lane :build_adhoc do
UI.message("app_name: #{app_name}")
UI.message("app_identifier: #{app_identifier}")
UI.message("apple_id: #{apple_id}")
UI.message("team_id: #{team_id}")
UI.message("sku: #{sku}")
xcodeprojpath = "../ios/" + app_name + ".xcodeproj"
proj = Xcodeproj::Project.open("../" + xcodeprojpath)
proj.build_configurations.each do |item|
item.build_settings["DEVELOPMENT_TEAM"] = team_id
item.build_settings["PROVISIONING_PROFILE_SPECIFIER"] = match_ad_hoc_provisioning
item.build_settings["CODE_SIGN_IDENTITY[sdk=iphoneos*]"] = match_ad_hoc_signing
item.build_settings["SWIFT_VERSION"] = swift_version
item.build_settings["ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES"] = "YES"
end
proj.recreate_user_schemes
proj.save
begin
disable_automatic_code_signing
rescue => ex
UI.message("failed to disable automatic signing")
UI.error(ex)
end
get_certificates(
development: false,
username: apple_id,
team_id: team_id,
)
unlock_keychain(
password: keychainPassword,
)
#bumpBuildNumber
sigh(username: apple_id, adhoc: true, readonly: false, app_identifier: app_identifier, team_id: team_id) #force: false,
gym(export_method: "ad-hoc",
clean: true,
configuration: "Release",
codesigning_identity: match_ad_hoc_signing,
export_team_id: team_id,
skip_profile_detection: true,
export_options: {
method: "ad-hoc",
signingStyle: "manual",
provisioningProfiles: { "#{app_identifier}": "#{match_ad_hoc_provisioning}" },
})
end

gym(export_method: "ad-hoc",
clean: true,
configuration: "Release",
codesigning_identity: match_ad_hoc_signing,
export_team_id: team_id,
skip_profile_detection: true,
export_options: {
method: "ad-hoc",
signingStyle: "manual",
provisioningProfiles: { "#{app_identifier}": "#{match_ad_hoc_provisioning}" },
{ "#{widget_identifier}": "#{match_ad_hoc_provisioning_for_widget}" }
})
You can add one more key for widget in export_options->provisioningProfiles for specifying provisioning profile of widget.

Related

Fastlane failed to detect to iOS App Development provisioning profiles

I am working with Fastlane script to set up automate ios build with CI/CD. During the build time, Fastlane was unable to detect the Development provisioning file. I am getting errors as follows
error: No profiles for 'my-app-identifier' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'my-app-identifie'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'My-target' from project 'App-scheme')
By default in Xcode the automatic settings code signing is enabled and tried to disable it. And have selected certificates after that I am able to build the ios application with Fastlane.
I have already provided the provisioning profile details of the build_app function. Is there any option to select provisioning profiles with Fastlane?
Fastfile
default_platform(:ios)
platform :ios do
before_all do |lane, options|
APP_ID=ENV['APP_ID']
APP_SCHEME=ENV['APP_SCHEME']
setup_ci
end
desc "Fetches the provisioning profiles so you can build locally and deploy to your device"
lane :certs do
match(app_identifier: [APP_ID], type: "appstore", readonly: true, git_branch: "new-2")
match(app_identifier: [APP_ID], type: "development", readonly: true, git_branch: "new-2")
match(app_identifier: [APP_ID], type: "adhoc", readonly: true, git_branch: "new-2")
end
desc "Description of what the lane does"
lane :beta do
# add actions here: https://docs.fastlane.tools/actions
# increment_build_number
connect_appstore_api
build_app(
scheme: APP_SCHEME,
export_method: "app-store",
output_directory: "./build/appstore/",
clean: true,
archive_path: "./build/build",
export_options: {
provisioningProfiles: {
APP_ID => "match AppStore #{APP_ID}",
}
}
)
# pilot
end
desc "Generate certificates"
lane :generate_certs do
connect_appstore_api
match(
app_identifier: [APP_ID],
type: "development",
readonly: false,
git_branch: "new-2"
)
match(
app_identifier: [APP_ID],
type: "adhoc",
readonly: false,
git_branch: "new-2"
)
match(
app_identifier: [APP_ID],
type: "appstore",
readonly: false,
git_branch: "new-2"
)
end
private_lane :connect_appstore_api do
app_store_connect_api_key(
duration: 1200, # optional (maximum 1200)
in_house: false,
is_key_content_base64: true
)
end
lane :check_ci do
if is_ci
puts "I'm a computer"
else
puts "Hi Human!"
end
end
end

Jenkins pipeline with userinput extendedChoice returns the values with [ ] at the beginning and end

I added the below to the pipeline so while the pipeline is running - at some stage I want the user to choose from the parameters but the output returns with parentheses at beginning and end.
def envs = input(id: 'Upgarde', message: 'On which customer do you want to apply the upgrade?', submitter: 'admin', ok: 'Submit', parameters: [extendedChoice(defaultValue: env.ENV.split().toString(), description: '', descriptionPropertyValue: env.ENV.split().toString(), multiSelectDelimiter: '', name: 'Customers to upgrade', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_MULTI_SELECT', value: env.ENV.split().toString())]).split(',')
Screenshot from the Jenkins UI:
enter image description here
Fixed by added .replace("[", "").replace("]", "")

Fastlane - undefined method configure for fastlane plugin

Following the documentation to create a custom plugin for fastlane.
Got an error while trying to use it :
Error in lane my_lane: undefined method `configure' for Fastlane::Mailjet:Module
It seems fastlane is trying to call a configure method somewhere.
However since there is no mention of it in the documentation i have absolutly no clue of what i should do.
Plugin available here : https://github.com/tirrorex/fastlane-plugin-mailjet
Call the action in my lane with
mailjet(
api_key: "key",
secret_key: "key",
sender: {
:email => "mail#mail.com",
:name => "Name"
},
recipients: options[:recipients],
subject: "subject",
textPart: "
Text.
",
templateLanguage: true,
templateErrorReporting: "mymail#mail.com",
templateErrorDeliver: "deliver",
templateId: id,
vars: {
"success":success,
"build_link": build_link,
},
attachments: attachments
)
The issue seems to be that in my plugin/action i use the mailjet gem.
When i try to call my mailjet action in my lane, fastlane instead is calling the mailjet gem which requires the configure method hence the error.
So it is a naming issue.
Any thoughts ?

Sign into GitLab with OAuth2 Custom provider does not map user information

I've installed Gitlab-CE on a CentOS VM and am trying to configure the Sign On with an generic OAuth2 provider, to be more specific am actually using IBM Security Access Manager 9.0.6.
So far Sign On works after tweeking a bit the omniauth-oauth2-generic gem configuration :
I do see the SSO Button :
And on the administration area i do find my user with the oauth2 identity provider :
My problem is that the user information is not set when the user signs on :
Here it's my omniauth configuration :
#https://gitlab.com/satorix/omniauth-oauth2-generic
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['oauth2_generic']
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_providers'] = [
{
'name' => 'oauth2_generic',
'app_id' => '9gzCzRKeiipexDRXsJOJ',
'app_secret' => 'mysecret',
'args' => {
client_options: {
'site' => 'https://example.com', # including port if necessary
'authorize_url': '/mga/sps/oauth/oauth20/authorize',
'token_url': '/mga/sps/oauth/oauth20/token',
'user_info_url' => '/mga/sps/oauth/oauth20/userinfo'
},
user_response_structure: {
root_path: [],
id_path: ['sub'],
attributes: {
nickname: 'sub',
name: 'name',
first_name: 'given_name',
last_name: 'family_name'
}
}
# optionally, you can add the following two lines to "white label" the display name
# of this strategy (appears in urls and Gitlab login buttons)
# If you do this, you must also replace oauth2_generic, everywhere it appears above, with the new name.
#name: 'IBM ISAM', # display name for this strategy
#strategy_class: "OmniAuth::Strategies::OAuth2Generic" # Devise-specific config option Gitlab uses to find renamed strategy
}
}
]
And my user info endpoint returns :
{ "sub":"XCQX342",
"nickname": "Kalem",
"name": "My name",
"given_name": "My name",
"family_name": "My surname",
"email": "myemail#example.com"
}
I've compare my configuration with http://lifeinide.com/post/2017-08-30-jetbrains-hub-as-oauth2-provider-for-gitlab/ but i don't see what am doing wrong, and why gitlab is not able to my parse the user attributes.
Thx for your help.
I hope you are resolved your problem.
If not :
Try direct to set field as in this case
https://gitlab.com/satorix/omniauth-oauth2-generic/blob/master/lib/omniauth/strategies/oauth2_generic.rb#L20
Simural as you set there
user_response_structure: {
root_path: [],
id_path: ['sub'],
attributes: {
nickname: 'sub',
name: 'name',
first_name: 'given_name',
last_name: 'family_name',
email: 'email'
}
}

Using HealthKit with Fastlane Match

I tried to enable the HealthKit capability in Xcode, but I got an error.
Add the HealthKit feature to your App ID.
Provisioning profile "match AdHoc com.mycompany.myapp" doesn't
support the HealthKit capability.
Can I fix this? Do I have to ignore it?
My Fastfile looks like that:
fastlane_version "2.35.1"
default_platform :ios
platform :ios do
before_all do
end
desc "Runs all the tests"
lane :test do
scan
end
desc "Build a new beta version"
desc "This will also make sure the profile is up to date"
lane :beta do
register_devices(
devices: {
...
}
)
match(type: "adhoc", force_for_new_devices: true)
gym(
scheme: "myapp",
clean: true,
silent: true,
output_directory: "../build/beta/"
)
end
desc "Deploy a new version to the App Store"
lane :release do
match(type: "appstore")
# snapshot
gym(
scheme: "myapp",
clean: true,
silent: true,
output_directory: "../build/release/"
)
end
end
I also tried to nuke everything, but it didn't help.

Resources