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

[ENG-1395] support new build status: new #475

Merged
merged 2 commits into from
Jun 24, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ This is the log of notable changes to EAS CLI and related packages.
### 🎉 New features

- Make credentials manager work with multi-target iOS projects. ([#441](https://github.com/expo/eas-cli/pull/441) by [@dsokal](https://github.com/dsokal))
- Copy over credentials from Expo Classic to EAS ([#445](https://github.com/expo/eas-cli/pull/445) by [@quinlanj](https://github.com/quinlanj))
- Copy over credentials from Expo Classic to EAS. ([#445](https://github.com/expo/eas-cli/pull/445) by [@quinlanj](https://github.com/quinlanj))
- Add Big Sur image for iOS builds. ([#457](https://github.com/expo/eas-cli/pull/457) by [@wkozyra95](https://github.com/wkozyra95))
- New version of Android credentials manager ([#460](https://github.com/expo/eas-cli/pull/460) by [@quinlanj](https://github.com/quinlanj))
- New version of Android credentials manager. ([#460](https://github.com/expo/eas-cli/pull/460) by [@quinlanj](https://github.com/quinlanj))
- Add an internal distribution with dev client to `build:configure` defaults. ([#465](https://github.com/expo/eas-cli/pull/465) by [@fson](https://github.com/fson))
- Add `updates.channel` to build metadata. ([#461](https://github.com/expo/eas-cli/pull/461) by [@jkhales](https://github.com/jkhales))
- iOS push key setup and management now available in `eas-cli credentials` ([#469](https://github.com/expo/eas-cli/pull/469) [#470](https://github.com/expo/eas-cli/pull/470) by [@quinlanj](https://github.com/quinlanj))

- iOS push key setup and management now available in `eas-cli credentials`. ([#469](https://github.com/expo/eas-cli/pull/469) [#470](https://github.com/expo/eas-cli/pull/470) by [@quinlanj](https://github.com/quinlanj))
- Support new build status: `new`. ([#475](https://github.com/expo/eas-cli/pull/475) by [@dsokal](https://github.com/dsokal))

### 🐛 Bug fixes

### 🧹 Chores

- Deprecate `--skip-credentials-check` flag because it doesn't do anything and is no longer needed.([#442](https://github.com/expo/eas-cli/pull/442) by [@brentvatne](https://github.com/brentvatne))
- Move android credentials code to new Graphql API ([#439](https://github.com/expo/eas-cli/pull/439) [#440](https://github.com/expo/eas-cli/pull/440) [#438](https://github.com/expo/eas-cli/pull/438) [#443](https://github.com/expo/eas-cli/pull/443) [#447](https://github.com/expo/eas-cli/pull/447) [#451](https://github.com/expo/eas-cli/pull/451) [#455](https://github.com/expo/eas-cli/pull/455) by [@quinlanj](https://github.com/quinlanj))
- Prepare Graphql infra to support iOS push keys ([#456](https://github.com/expo/eas-cli/pull/456) by [@quinlanj](https://github.com/quinlanj))
- Deprecate `--skip-credentials-check` flag because it doesn't do anything and is no longer needed. ([#442](https://github.com/expo/eas-cli/pull/442) by [@brentvatne](https://github.com/brentvatne))
- Move android credentials code to new Graphql API. ([#439](https://github.com/expo/eas-cli/pull/439) [#440](https://github.com/expo/eas-cli/pull/440) [#438](https://github.com/expo/eas-cli/pull/438) [#443](https://github.com/expo/eas-cli/pull/443) [#447](https://github.com/expo/eas-cli/pull/447) [#451](https://github.com/expo/eas-cli/pull/451) [#455](https://github.com/expo/eas-cli/pull/455) by [@quinlanj](https://github.com/quinlanj))
- Prepare Graphql infra to support iOS push keys. ([#456](https://github.com/expo/eas-cli/pull/456) by [@quinlanj](https://github.com/quinlanj))
- Improve credentials DX ([#448](https://github.com/expo/eas-cli/pull/448) [#449](https://github.com/expo/eas-cli/pull/449) by [@quinlanj](https://github.com/quinlanj))
- Add analytics on dev client builds. ([#454](https://github.com/expo/eas-cli/pull/454) by [@fson](https://github.com/fson))
- Support non-git projects. ([#462](https://github.com/expo/eas-cli/pull/462) by [@wkozyra95](https://github.com/wkozyra95))
Expand Down
46 changes: 39 additions & 7 deletions packages/eas-cli/graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3875,6 +3875,12 @@
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "NEW",
"description": "",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "IN_QUEUE",
"description": "",
Expand Down Expand Up @@ -7934,6 +7940,30 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "iosAppCredentialsList",
"description": "",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "IosAppCredentials",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
Expand Down Expand Up @@ -17397,13 +17427,9 @@
"name": "appleTeamId",
"description": "",
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
"kind": "SCALAR",
"name": "ID",
"ofType": null
},
"defaultValue": null
},
Expand Down Expand Up @@ -20249,6 +20275,12 @@
"description": "",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "DEV_CLIENT_USERS",
"description": "",
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
Expand Down
5 changes: 5 additions & 0 deletions packages/eas-cli/src/build/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ async function waitForBuildEndAsync(
case BuildStatus.Finished:
spinner.succeed('Build finished');
return builds;
case BuildStatus.New:
spinner.text = 'Build created';
break;
case BuildStatus.InQueue:
spinner.text = 'Build queued...';
break;
Expand Down Expand Up @@ -131,13 +134,15 @@ async function waitForBuildEndAsync(
spinner.fail('Some of the builds were canceled or failed.');
return builds;
} else {
const newBuilds = builds.filter(build => build?.status === BuildStatus.New).length;
const inQueue = builds.filter(build => build?.status === BuildStatus.InQueue).length;
const inProgress = builds.filter(build => build?.status === BuildStatus.InProgress).length;
const errored = builds.filter(build => build?.status === BuildStatus.Errored).length;
const finished = builds.filter(build => build?.status === BuildStatus.Finished).length;
const canceled = builds.filter(build => build?.status === BuildStatus.Canceled).length;
const unknownState = builds.length - inQueue - inProgress - errored - finished;
spinner.text = [
newBuilds && `Builds created: ${newBuilds}`,
inQueue && `Builds in queue: ${inQueue}`,
inProgress && `Builds in progress: ${inProgress}`,
canceled && `Builds canceled: ${canceled}`,
Expand Down
1 change: 1 addition & 0 deletions packages/eas-cli/src/build/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export enum RequestedPlatform {
}

export enum BuildStatus {
NEW = 'new',
IN_QUEUE = 'in-queue',
IN_PROGRESS = 'in-progress',
ERRORED = 'errored',
Expand Down
20 changes: 10 additions & 10 deletions packages/eas-cli/src/build/utils/formatBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export function formatGraphQLBuild(build: BuildFragment) {
label: 'Status',
get value() {
switch (build.status) {
case GraphQLBuildStatus.New:
return chalk.blue('new');
case GraphQLBuildStatus.InQueue:
return chalk.blue('in queue');
case GraphQLBuildStatus.InProgress:
Expand Down Expand Up @@ -48,12 +50,8 @@ export function formatGraphQLBuild(build: BuildFragment) {
{
label: 'Artifact',
get value() {
if (
build.status === GraphQLBuildStatus.InQueue ||
build.status === GraphQLBuildStatus.InProgress
) {
}
switch (build.status) {
case GraphQLBuildStatus.New:
case GraphQLBuildStatus.InQueue:
case GraphQLBuildStatus.InProgress:
return '<in progress>';
Expand All @@ -72,11 +70,13 @@ export function formatGraphQLBuild(build: BuildFragment) {
{ label: 'Started at', value: new Date(build.createdAt).toLocaleString() },
{
label: 'Finished at',
value:
build.status === GraphQLBuildStatus.InQueue ||
build.status === GraphQLBuildStatus.InProgress
? '<in progress>'
: new Date(build.updatedAt).toLocaleString(),
value: [
GraphQLBuildStatus.New,
GraphQLBuildStatus.InQueue,
GraphQLBuildStatus.InProgress,
].includes(build.status)
? '<in progress>'
: new Date(build.updatedAt).toLocaleString(),
},
{ label: 'Started by', value: actor ?? 'unknown' },
];
Expand Down
15 changes: 12 additions & 3 deletions packages/eas-cli/src/commands/build/cancel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ function formatUnfinishedBuild(
): string {
const platform = appPlatformEmojis[build.platform];
const startTime = new Date(build.createdAt).toLocaleString();
const status = chalk.blue(build.status === BuildStatus.InQueue ? 'in-queue' : 'in-progress');
let statusText: string;
if (build.status === BuildStatus.New) {
statusText = 'new';
} else if (build.status === BuildStatus.InQueue) {
statusText = 'in queue';
} else {
statusText = 'in progress';
}
const status = chalk.blue(statusText);
return `${platform} Started at: ${startTime}, Status: ${status}, Id: ${build.id}`;
}

Expand All @@ -58,12 +66,13 @@ async function selectBuildToCancelAsync(
const spinner = ora().start('Fetching the uncompleted builds…');
let builds;
try {
const [inQueueBuilds, inProgressBuilds] = await Promise.all([
const [newBuilds, inQueueBuilds, inProgressBuilds] = await Promise.all([
BuildQuery.allForAppAsync(projectId, { status: BuildStatus.New }),
BuildQuery.allForAppAsync(projectId, { status: BuildStatus.InQueue }),
BuildQuery.allForAppAsync(projectId, { status: BuildStatus.InProgress }),
]);
spinner.stop();
builds = [...inQueueBuilds, ...inProgressBuilds];
builds = [...newBuilds, ...inQueueBuilds, ...inProgressBuilds];
} catch (error) {
spinner.fail(
`Something went wrong and we couldn't fetch the builds for the project ${projectFullName}.`
Expand Down
3 changes: 3 additions & 0 deletions packages/eas-cli/src/commands/build/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default class BuildList extends Command {
}),
status: flags.enum({
options: [
BuildStatus.NEW,
BuildStatus.IN_QUEUE,
BuildStatus.IN_PROGRESS,
BuildStatus.ERRORED,
Expand Down Expand Up @@ -92,6 +93,8 @@ const toAppPlatform = (requestedPlatform?: RequestedPlatform): AppPlatform | und
const toGraphQLBuildStatus = (buildStatus: BuildStatus): GraphQLBuildStatus | undefined => {
if (!buildStatus) {
return undefined;
} else if (buildStatus === BuildStatus.NEW) {
return GraphQLBuildStatus.New;
} else if (buildStatus === BuildStatus.IN_QUEUE) {
return GraphQLBuildStatus.InQueue;
} else if (buildStatus === BuildStatus.IN_PROGRESS) {
Expand Down
31 changes: 5 additions & 26 deletions packages/eas-cli/src/graphql/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ export enum AppPrivacy {
}

export enum BuildStatus {
New = 'NEW',
InQueue = 'IN_QUEUE',
InProgress = 'IN_PROGRESS',
Errored = 'ERRORED',
Expand Down Expand Up @@ -1092,6 +1093,7 @@ export type ApplePushKey = {
keyP8: Scalars['String'];
createdAt: Scalars['DateTime'];
updatedAt: Scalars['DateTime'];
iosAppCredentialsList: Array<IosAppCredentials>;
};

export type IosAppBuildCredentialsFilter = {
Expand Down Expand Up @@ -2650,7 +2652,7 @@ export type IosAppCredentialsMutationSetAppSpecificPasswordArgs = {
};

export type IosAppCredentialsInput = {
appleTeamId: Scalars['ID'];
appleTeamId?: Maybe<Scalars['ID']>;
pushKeyId?: Maybe<Scalars['ID']>;
appSpecificPasswordId?: Maybe<Scalars['ID']>;
};
Expand Down Expand Up @@ -3182,7 +3184,8 @@ export type AddUserInput = {
};

export enum MailchimpTag {
EasMasterList = 'EAS_MASTER_LIST'
EasMasterList = 'EAS_MASTER_LIST',
DevClientUsers = 'DEV_CLIENT_USERS'
}

export enum MailchimpAudience {
Expand Down Expand Up @@ -4802,30 +4805,6 @@ export type GetAllBuildsForAppQuery = (
)> }
);

export type PendingBuildsForAccountAndPlatformQueryVariables = Exact<{
accountName: Scalars['String'];
platform: AppPlatform;
}>;


export type PendingBuildsForAccountAndPlatformQuery = (
{ __typename?: 'RootQuery' }
& { account: (
{ __typename?: 'AccountQuery' }
& { byName: (
{ __typename?: 'Account' }
& Pick<Account, 'id'>
& { inQueueBuilds: Array<(
{ __typename?: 'Build' }
& Pick<Build, 'id' | 'platform'>
)>, inProgressBuilds: Array<(
{ __typename?: 'Build' }
& Pick<Build, 'id' | 'platform'>
)> }
) }
) }
);

export type EnvironmentSecretsByAccountNameQueryVariables = Exact<{
accountName: Scalars['String'];
}>;
Expand Down
53 changes: 0 additions & 53 deletions packages/eas-cli/src/graphql/queries/BuildQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {
BuildsByIdQueryVariables,
GetAllBuildsForAppQuery,
GetAllBuildsForAppQueryVariables,
PendingBuildsForAccountAndPlatformQuery,
PendingBuildsForAccountAndPlatformQueryVariables,
} from '../generated';
import { BuildFragmentNode } from '../types/Build';

Expand Down Expand Up @@ -90,55 +88,4 @@ export const BuildQuery = {

return data.app?.byId.builds ?? [];
},

async getPendingBuildIdAsync(
accountName: string,
platform: AppPlatform
): Promise<PendingBuildQueryResult | null> {
const data = await withErrorHandlingAsync(
graphqlClient
.query<
PendingBuildsForAccountAndPlatformQuery,
PendingBuildsForAccountAndPlatformQueryVariables
>(
gql`
query PendingBuildsForAccountAndPlatform(
$accountName: String!
$platform: AppPlatform!
) {
account {
byName(accountName: $accountName) {
id
inQueueBuilds: builds(
offset: 0
limit: 1
platform: $platform
status: IN_QUEUE
) {
id
platform
}
inProgressBuilds: builds(
offset: 0
limit: 1
platform: $platform
status: IN_PROGRESS
) {
id
platform
}
}
}
}
`,
{ accountName, platform }
)
.toPromise()
);
const pendingBuilds = [
...data.account.byName.inProgressBuilds,
...data.account.byName.inQueueBuilds,
];
return pendingBuilds.length > 0 ? pendingBuilds[0] : null;
},
};