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] Add support for Developer ID certificates from G2 Sub-CA #20145

Merged
merged 2 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 15 additions & 7 deletions cert/lib/cert/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,26 +138,34 @@ def find_existing_cert
# All certificates of this type
def certificates
filter = {
certificateType: certificate_type
certificateType: certificate_types.join(",")
}
return Spaceship::ConnectAPI::Certificate.all(filter: filter)
end

# The kind of certificate we're interested in
# The kind of certificate we're interested in (for creating)
def certificate_type
return certificate_types.first
end

# The kind of certificates we're interested in (for listing)
def certificate_types
if Cert.config[:type]
case Cert.config[:type].to_sym
when :mac_installer_distribution
return Spaceship::ConnectAPI::Certificate::CertificateType::MAC_INSTALLER_DISTRIBUTION
return [Spaceship::ConnectAPI::Certificate::CertificateType::MAC_INSTALLER_DISTRIBUTION]
when :developer_id_application
return Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION
return [
Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION_G2,
Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION
]
when :developer_id_kext
return Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_KEXT
return [Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_KEXT]
when :developer_id_installer
if !Spaceship::ConnectAPI.token.nil?
raise "As of 2021-11-09, the App Store Connect API does not allow accessing DEVELOPER_ID_INSTALLER with the API Key. Please file an issue on GitHub if this has changed and needs to be updated"
else
return Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_INSTALLER
return [Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_INSTALLER]
end
else
UI.user_error("Unaccepted value for :type - #{Cert.config[:type]}")
Expand All @@ -182,7 +190,7 @@ def certificate_type
end
end

return cert_type
return [cert_type]
end

def create_certificate
Expand Down
3 changes: 2 additions & 1 deletion match/lib/match/importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def import_cert(params, cert_path: nil, p12_path: nil, profile_path: nil)
].join(',')
when :developer_id_application
certificate_type = [
Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION
Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION,
Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION_G2
].join(',')
when :mac_installer_distribution
certificate_type = [
Expand Down
3 changes: 2 additions & 1 deletion sigh/lib/sigh/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ def certificates_for_profile_and_platform
]
elsif profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DIRECT || profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DIRECT
types = [
Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION
Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION,
Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION_G2
]
else
types = [
Expand Down
1 change: 1 addition & 0 deletions spaceship/lib/spaceship/connect_api/models/certificate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module CertificateType
MAC_APP_DEVELOPMENT = "MAC_APP_DEVELOPMENT"
DEVELOPER_ID_KEXT = "DEVELOPER_ID_KEXT"
DEVELOPER_ID_APPLICATION = "DEVELOPER_ID_APPLICATION"
DEVELOPER_ID_APPLICATION_G2 = "DEVELOPER_ID_APPLICATION_G2"

# As of 2021-11-09, this is only available with Apple ID auth
DEVELOPER_ID_INSTALLER = "DEVELOPER_ID_INSTALLER"
Expand Down