sign-here
sign-here copied to clipboard
[Proposal] Auto regenerate provisioning profiles
Hello! I know how frustrating is to regenerate the provisioning profiles for ad-hoc distribution after registering a new device.
What we did at Rappi was to evaluate if there are new devices vs the ones registered in a profile, if so, we deleted the profile and created a new one since the API doesn't allow you to modify it.
I wrote about it here https://engineering.rappi.com/ios-infra-at-rappi-1598341069b8 (Provisioning section)
So I would like to include this functionality in your tool, if that makes sense for you. Before writing any code I preferred to open this issue to discuss it.
Right now if you try to generate a profile that already exists, the tool gives you this error:
Error: [iTunesConnectServiceImp] Unable to decode response
- Decoding Error: keyNotFound(CodingKeys(stringValue: "data", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: \"data\", intValue: nil) (\"data\").", underlyingError: nil))
- Response: {
"errors" : [ {
"id" : "da562397-d8ca-4df3-b55f-79eff707aa59",
"status" : "409",
"code" : "ENTITY_ERROR",
"title" : "There is a problem with the request entity",
"detail" : "Multiple profiles found with the name 'Test'. Please remove the duplicate profiles and try again."
} ]
}
So I was thinking to include a new flag like this:
bazel run //Sources/SignHereTool:sign-here -- create-provisioning-profile --auto-regenerate
When it is active and detects this error type, it will automatically delete the profile and retry generating it. At first, I was thinking evaluating if the device list has changed but that will add a another network call 🤔
So the flow would be like this:
- The profile creation fails with the above error
- Evaluate if the flag --auto-regenerate exists
- Evaluate if the data can be parsed to ErrorResponse https://developer.apple.com/documentation/appstoreconnectapi/errorresponse
- Evaluate if the error code is ENTITY_ERROR https://developer.apple.com/documentation/appstoreconnectapi/interpreting_and_handling_errors/parsing_the_error_response_code
- If all the evaluations are true, then the profile is deleted and the creation request is retried once.
What do you think? Thanks!