diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b800aa6a0..eee5d3b387 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This is the log of notable changes to EAS CLI and related packages. - Port more options to the beta credentials manager. ([#352](https://github.com/expo/eas-cli/pull/352), [357](https://github.com/expo/eas-cli/pull/357), [361](https://github.com/expo/eas-cli/pull/361) by [@quinlanj](https://github.com/quinlanj)) - Add getBuildProfileNamesAsync helper to EasJsonReader. ([#351](https://github.com/expo/eas-cli/pull/351) by [@quinlanj](https://github.com/quinlanj)) - Increase build timeout to 1 hour. ([#370](https://github.com/expo/eas-cli/pull/370) by [@wkozyra95](https://github.com/wkozyra95)) +- Remove check for pending builds. ([#373](https://github.com/expo/eas-cli/pull/373) by [@wkozyra95](https://github.com/wkozyra95)) ## [0.13.0](https://github.com/expo/eas-cli/releases/tag/v0.13.0) - 2021-04-22 diff --git a/packages/eas-cli/src/build/build.ts b/packages/eas-cli/src/build/build.ts index b33b01ca1b..2804ed1d05 100644 --- a/packages/eas-cli/src/build/build.ts +++ b/packages/eas-cli/src/build/build.ts @@ -113,6 +113,16 @@ export async function prepareBuildRequestForPlatformAsync< } catch (error) { if (error?.graphQLErrors?.[0]?.extensions?.errorCode === 'TURTLE_DEPRECATED_JOB_FORMAT') { Log.error('EAS Build API has changed, please upgrade to the latest eas-cli version.'); + throw new Error('Build request failed.'); + } else if ( + error?.graphQLErrors?.[0]?.extensions?.errorCode === 'EAS_BUILD_TOO_MANY_PENDING_BUILDS' + ) { + Log.error( + `You have already reached the maximum number of pending ${ + requestedPlatformDisplayNames[job.platform] + } builds for your account. Try again later.` + ); + throw new Error('Build request failed.'); } else if (error?.graphQLErrors) { Log.error( 'Build request failed. Make sure you are using the latest eas-cli version. If the problem persists, please report the issue.' diff --git a/packages/eas-cli/src/commands/build/index.ts b/packages/eas-cli/src/commands/build/index.ts index f37319018d..29090cafad 100644 --- a/packages/eas-cli/src/commands/build/index.ts +++ b/packages/eas-cli/src/commands/build/index.ts @@ -2,7 +2,6 @@ import { ExpoConfig, getConfig } from '@expo/config'; import { Command, flags } from '@oclif/command'; import chalk from 'chalk'; import fs from 'fs-extra'; -import nullthrows from 'nullthrows'; import path from 'path'; import { @@ -13,22 +12,14 @@ import { configureAsync } from '../../build/configure'; import { createCommandContextAsync } from '../../build/context'; import { buildAsync } from '../../build/create'; import { RequestedPlatform } from '../../build/types'; -import { formatGraphQLBuild } from '../../build/utils/formatBuild'; import { isGitStatusCleanAsync } from '../../build/utils/repository'; -import { AppPlatform } from '../../graphql/generated'; -import { BuildQuery } from '../../graphql/queries/BuildQuery'; import Log, { learnMore } from '../../log'; import { isEasEnabledForProjectAsync, warnEasUnavailable, } from '../../project/isEasEnabledForProject'; -import { - findProjectRootAsync, - getProjectAccountNameAsync, - getProjectIdAsync, -} from '../../project/projectUtils'; +import { findProjectRootAsync, getProjectIdAsync } from '../../project/projectUtils'; import { confirmAsync, promptAsync } from '../../prompts'; -import { Actor } from '../../user/User'; import { ensureLoggedInAsync } from '../../user/actions'; export default class Build extends Command { @@ -71,7 +62,7 @@ export default class Build extends Command { const { flags } = this.parse(Build); await initAnalyticsAsync(); // TODO: run in oclif hook for every command try { - const user = await ensureLoggedInAsync(); + await ensureLoggedInAsync(); const nonInteractive = flags['non-interactive']; if (!flags.platform && nonInteractive) { @@ -95,17 +86,6 @@ export default class Build extends Command { return; } - const accountName = await getProjectAccountNameAsync(exp); - const accountHasPendingBuilds = await ensureNoPendingBuildsExistAsync({ - accountName, - platform, - projectId, - user, - }); - if (accountHasPendingBuilds) { - return; - } - exp = (await ensureProjectConfiguredAsync(projectDir)) ?? exp; const commandCtx = await createCommandContextAsync({ @@ -128,49 +108,6 @@ export default class Build extends Command { } } -async function ensureNoPendingBuildsExistAsync({ - user, - platform, - accountName, - projectId, -}: { - user: Actor; - platform: RequestedPlatform; - accountName: string; - projectId: string; -}): Promise { - // allow expo admins to run as many builds as they wish - if (user.isExpoAdmin) { - return false; - } - - const appPlatforms = toAppPlatforms(platform); - const maybePendingBuilds = await Promise.all( - appPlatforms.map(appPlatform => BuildQuery.getPendingBuildIdAsync(accountName, appPlatform)) - ); - const pendingBuilds = maybePendingBuilds.filter(i => i !== null); - if (pendingBuilds.length > 0) { - Log.newLine(); - Log.error( - 'Your other builds are still pending. Wait for them to complete before running this command again.' - ); - Log.newLine(); - const results = await Promise.all( - pendingBuilds.map(pendingBuild => { - return BuildQuery.byIdAsync(nullthrows(pendingBuild).id); - }) - ); - - for (const result of results) { - Log.log(formatGraphQLBuild(result)); - } - - process.exitCode = 1; - return true; - } - return false; -} - function verifyOptionsForLocalBuilds(platform: RequestedPlatform): boolean { if (platform === RequestedPlatform.All) { Log.error('Builds for multiple platforms are not supported with flag --local'); @@ -183,16 +120,6 @@ function verifyOptionsForLocalBuilds(platform: RequestedPlatform): boolean { } } -function toAppPlatforms(requestedPlatform: RequestedPlatform): AppPlatform[] { - if (requestedPlatform === RequestedPlatform.All) { - return [AppPlatform.Android, AppPlatform.Ios]; - } else if (requestedPlatform === RequestedPlatform.Android) { - return [AppPlatform.Android]; - } else { - return [AppPlatform.Ios]; - } -} - async function promptForPlatformAsync(): Promise { const { platform } = await promptAsync({ type: 'select',