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

[match] added selection of certificate and p12 key by certificate id #21428

Merged
merged 3 commits into from Oct 6, 2023

Conversation

slacklab
Copy link
Contributor

@slacklab slacklab commented Jul 28, 2023

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

Changes are needed to seamlessly update certificates and provisioning profiles for case:

  1. Create a new distribution signing certificate (the old certificate remains in match storage and apple portal)
  2. Put the signing certificate in the match storage, next to the old one
  3. Update profiles for new signing certificate at match storage

Because 
currently match can only work with a single certificate (.last without sorting)

More details at fastlane/match/lib/match/runner.rb:

def fetch_certificate(params: nil, working_directory: nil, specific_cert_type: nil)
  ...
  certs = Dir[File.join(prefixed_working_directory, "certs", cert_type.to_s, "*.cer")]
  keys = Dir[File.join(prefixed_working_directory, "certs", cert_type.to_s, "*.p12")]
    ...
    cert_path = certs.last
    ...
    Utils.import(keys.last, params[:keychain_name], password: params[:keychain_password])
    ...
    FileUtils.cp(keys.last, params[:output_path])
    ...
end

Description

Added ENV variable MATCH_CERTIFICATE_ID for select a signing certificate and P12 key by ID

Feature is needed for the gradual transition of apps to a new signing certificate at update profiles (without revoking the old certificate)



Adds the ability to match to store multiple certificates and use the required one at updating profiles.







Testing steps

Test case №1

  1. Match git repo stores distribution signing certificate created in 2022
  2. The project uses this certificate from 2022
  3. Put in the match git repo the distribution certificate, the signing certificate created in 2023
  4. Specify MATCH_CERTIFICATE_ID in fastlane/.env of the certificate created in 2023 (fresh)
  5. Update profiles via match
  6. Certificate created in 2023 is used

Test case №2

  1. Delete MATCH_CERTIFICATE_ID from ENV
  2. Update match profiles
  3. Uses last certificate and p12 keys (created in 2022)

@google-cla
Copy link

google-cla bot commented Jul 28, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@slacklab slacklab force-pushed the match-select-certificate-by-id branch from ff5f9a8 to 44d47d6 Compare July 28, 2023 07:12
@slacklab slacklab changed the title Match. Added selection certificate and p12 key by ENV MATCH_CERTIFICATE_ID [match] added selection certificate and p12 key by certificate id Jul 28, 2023
@slacklab slacklab changed the title [match] added selection certificate and p12 key by certificate id [match] added selection of certificate and p12 key by certificate id Jul 28, 2023
@slacklab slacklab marked this pull request as ready for review July 28, 2023 10:35
Copy link
Collaborator

@getaaron getaaron left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @slacklab !

@getaaron getaaron merged commit e67aab8 into fastlane:master Oct 6, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants