Compare commits

..
Author SHA1 Message Date
Quinlan Jung e998f5a942 use asc api key if it exists for builds 2024-05-28 14:42:59 +02:00
Quinlan Jung c3f73fc466 amend apple team 2024-05-20 16:33:47 +02:00
Quinlan Jung 08f938962b mange asc api key 2024-05-20 16:30:17 +02:00
7 changed files with 903 additions and 6083 deletions

No files matched your search

+24 -10
View File
@@ -22838,16 +22838,6 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "SCALAR",
"name": "DevDomainName",
"description": "A DevDomainName for a deployed serverless app",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "DeploymentsMutation",
@@ -25034,6 +25024,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "repack",
"description": "Repack the golden dev client build instead of running full build process. Used for onboarding. Do not use outside of onboarding flow, as for now it's only created with this specific use case in mind.",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "submitProfile",
"description": null,
@@ -29852,6 +29854,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "gitCommitMessage",
"description": null,
"args": [],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "gitRef",
"description": null,
+4 -6
View File
@@ -16,7 +16,6 @@ import { Analytics, AnalyticsEventProperties, BuildEvent } from '../analytics/An
import { DynamicConfigContextFn } from '../commandUtils/context/DynamicProjectConfigContextField';
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
import { CredentialsContext } from '../credentials/context';
import { AppStoreApiKeyPurpose } from '../credentials/ios/actions/AscApiKeyUtils';
import { getAppFromContextAsync } from '../credentials/ios/actions/BuildCredentialsUtils';
import { GetAscApiKey } from '../credentials/ios/actions/GetAscApiKey';
import { CustomBuildConfigMetadata } from '../project/customBuildConfig';
@@ -166,13 +165,12 @@ export async function createBuildContextAsync<T extends Platform>({
...(await getAppFromContextAsync(credentialsCtx)),
bundleIdentifier: (iosBuildCtx as BuildContext<Platform.IOS>).ios.bundleIdentifier,
};
const getAscApiKeyAction = new GetAscApiKey(
const ascForBuilds = await GetAscApiKey.getForBuildServiceAsync(
appLookupParams,
AppStoreApiKeyPurpose.BUILD_SERVICE
credentialsCtx
);
const ascApiKeyManagedByExpo = await getAscApiKeyAction.runAsync(credentialsCtx);
if (ascApiKeyManagedByExpo) {
// TODO: set credentialCtx with the correct options
if (ascForBuilds) {
credentialsCtx.configureAppStoreAuth(ascForBuilds);
}
return iosBuildCtx;
+5 -13
View File
@@ -7,10 +7,9 @@ import * as AndroidGraphqlClient from './android/api/GraphqlClient';
import * as IosGraphqlClient from './ios/api/GraphqlClient';
import AppStoreApi from './ios/appstore/AppStoreApi';
import { AuthenticationMode } from './ios/appstore/authenticateTypes';
import { MinimalAscApiKey } from './ios/credentials';
import { Analytics } from '../analytics/AnalyticsManager';
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
import { AppStoreConnectApiKeyFragment } from '../graphql/generated';
import { AppStoreConnectApiKeyFragment, AppleTeamType } from '../graphql/generated';
import Log from '../log';
import { getPrivateExpoConfig } from '../project/expoConfig';
import { confirmAsync } from '../prompts';
@@ -88,23 +87,16 @@ export class CredentialsContext {
}
public configureAppStoreAuth(ascApiKey: AppStoreConnectApiKeyFragment): void {
/* keyP8: string;
keyId: string;
issuerId: string;
teamId?: string;
teamName?: string;
roles?: UserRole[];
name?: string; */
this.appStore.authCtx = {
ascApiKey: {
keyP8: ascApiKey.keyP8,
keyId: ascApiKey.keyIdentifier,
issuerId: ascApiKey.issuerIdentifier,
},
appleTeam: {
teamIdentifier: ascApiKey.appleTeam?.appleTeamIdentifier ?? '',
teamName: ascApiKey.appleTeam?.appleTeamName,
teamType: ascApiKey.appleTeam,
team: {
id: ascApiKey.appleTeam?.appleTeamIdentifier ?? '',
name: ascApiKey.appleTeam?.appleTeamName ?? undefined,
inHouse: ascApiKey.appleTeam?.appleTeamType === AppleTeamType.InHouse ?? false,
},
};
}
@@ -1,39 +1,32 @@
import { AppStoreApiKeyPurpose } from './AscApiKeyUtils';
import { AppStoreConnectApiKeyFragment } from '../../../graphql/generated';
import Log from '../../../log';
import { CredentialsContext } from '../../context';
import { AppLookupParams } from '../api/graphql/types/AppLookupParams';
export class GetAscApiKey {
constructor(
private app: AppLookupParams,
private purpose: AppStoreApiKeyPurpose
) {}
public async runAsync(ctx: CredentialsContext): Promise<AppStoreConnectApiKeyFragment | null> {
static async getForBuildServiceAsync(
app: AppLookupParams,
ctx: CredentialsContext
): Promise<AppStoreConnectApiKeyFragment | null> {
const appCredentials = await ctx.ios.getIosAppCredentialsWithCommonFieldsAsync(
ctx.graphqlClient,
this.app
app
);
if (this.purpose === AppStoreApiKeyPurpose.SUBMISSION_SERVICE) {
return appCredentials?.appStoreConnectApiKeyForSubmissions ?? null;
} else if (this.purpose === AppStoreApiKeyPurpose.BUILD_SERVICE) {
const ascApiKey = appCredentials?.appStoreConnectApiKeyForBuilds;
if (!ascApiKey) {
return null;
}
const appleTeam = ascApiKey.appleTeam;
const hasAppleTeamInfo =
!!appleTeam && !!appleTeam.appleTeamIdentifier && !!appleTeam.appleTeamType;
if (!hasAppleTeamInfo) {
Log.warn(
`App Store Connect API Key for ${this.purpose} is missing Apple Team information. Run "eas credentials" and select "Use an existing API Key" to update the missing information.`
);
return null;
}
return ascApiKey;
} else {
throw new Error(`App Store Connect API Keys are not yet supported for ${this.purpose}.`);
const ascApiKey = appCredentials?.appStoreConnectApiKeyForBuilds;
if (!ascApiKey) {
return null;
}
const appleTeam = ascApiKey.appleTeam;
const appleTeamIdentifier = appleTeam?.appleTeamIdentifier;
const appleTeamType = appleTeam?.appleTeamType;
const hasAppleTeamInfo = !!appleTeamIdentifier && !!appleTeamType;
if (!hasAppleTeamInfo) {
Log.warn(
`App Store Connect API Key for EAS Build is missing Apple Team information. Run "eas credentials" and select "Use an existing API Key" to update the missing information.`
);
return null;
}
return ascApiKey;
}
}
@@ -49,7 +49,7 @@ import { AppleTeamType } from '../../../graphql/generated';
import Log from '../../../log';
import { MinimalAscApiKey } from '../credentials';
type AscApiKeyAuth = {
export type AscApiKeyAuth = {
ascApiKey: MinimalAscApiKey;
appleTeam: { teamIdentifier: string; teamName?: string; teamType: AppleTeamType };
};
+848 -6026
View File
File diff suppressed because it is too large. Load diff
@@ -12,6 +12,7 @@ export const AppStoreConnectApiKeyFragmentNode = gql`
}
issuerIdentifier
keyIdentifier
keyP8
name
roles
createdAt