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

Add support for certificate type DEVELOPER_ID_APPLICATION_G2 #415

Conversation

priitlatt
Copy link
Contributor

@priitlatt priitlatt commented Jul 4, 2024

Resolves #414

When creating Developer ID Application certificate in Apple Developer Portal, it is possible to select "G2 Sub-CA" for its profile type:

Screenshot 2024-07-04 at 12 15 32 (1)

The certificate that is created will have type DEVELOPER_ID_APPLICATION_G2, which as of 04.07.24 is not documented as a possible certificate type, but is used nonetheless.

Changes in this PR add bindings for this type and make it possible to use such certificates when requesting certificates for provisioning profiles of type MAC_APP_DIRECT and MAC_CATALYST_APP_DIRECT.

Updated actions:

  • app-store-connect fetch-signing-files
  • app-store-connect certificates list

@priitlatt priitlatt marked this pull request as ready for review July 4, 2024 14:50
only the passed type.
"""
resolved_types = CertificateType.resolve(certificate_types=certificate_type)
assert resolved_types == [certificate_type]
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be

Suggested change
assert resolved_types == [certificate_type]
assert resolved_types == certificate_type

instead?

Since certificate_type is already a list of all possible certificate types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, we parametrize over the values in CertificateType enumeration. Each certificate_type is an instance of CertificateType. Something like

>>> class E(Enum):
...   A = 'A'
...   B = 'B'
...
>>> list(E)
[<E.A: 'A'>, <E.B: 'B'>]

@@ -200,6 +211,39 @@ def from_profile_type(cls, profile_type: ProfileType) -> CertificateType:
else:
raise ValueError(f"Certificate type for profile type {profile_type} is unknown")

@classmethod
def resolve(
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not quite obvious what we resolve. Consider naming it like list_expected_certificate_types. Or just add a docstring with a brief explanation...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in eca517b.

Copy link
Contributor

@artemii-yanushevskyi artemii-yanushevskyi left a comment

Choose a reason for hiding this comment

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

Left a few minor remarks

priitlatt and others added 3 commits July 5, 2024 12:14
Co-authored-by: Artemii <40743076+artemii-yanushevskyi@users.noreply.github.com>
…-id-application-g2' of github.com:codemagic-ci-cd/cli-tools into bugfix/414-app-store-connect-certificate-type-developer-id-application-g2
Comment on lines -221 to +210
return []
return
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was suddenly picked up by mypy. This is a generator function and return values are meaningless as the function does not return a single value at any point, but a generator object. This return just ensures that we're never going to reach a yield statement.

@priitlatt priitlatt merged commit 279c900 into master Jul 5, 2024
11 checks passed
@priitlatt priitlatt deleted the bugfix/414-app-store-connect-certificate-type-developer-id-application-g2 branch July 5, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-store-connect bug Something isn't working
Projects
None yet
2 participants