Compare commits

...
Author SHA1 Message Date
Piotr Szeremeta 6b3074e436 Revert "Add eas env:push and env:pull commands (#2495)"
This reverts commit 56510f0925.
2024-08-27 14:40:12 +02:00
30 changed files with 1021 additions and 7544 deletions

No files matched your search

+35 -514
View File
@@ -1226,83 +1226,6 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "auditLogsPaginated",
"description": "Audit logs for account",
"args": [
{
"name": "after",
"description": null,
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "before",
"description": null,
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "filter",
"description": null,
"type": {
"kind": "INPUT_OBJECT",
"name": "AuditLogFilterInput",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "first",
"description": null,
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "last",
"description": null,
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "AuditLogConnection",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "availableBuilds", "name": "availableBuilds",
"description": null, "description": null,
@@ -10587,18 +10510,6 @@
"name": "workerDeploymentsRequests", "name": "workerDeploymentsRequests",
"description": null, "description": null,
"args": [ "args": [
{
"name": "filter",
"description": null,
"type": {
"kind": "INPUT_OBJECT",
"name": "WorkerDeploymentRequestsFilter",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "limit", "name": "limit",
"description": null, "description": null,
@@ -16438,100 +16349,6 @@
"enumValues": null, "enumValues": null,
"possibleTypes": null "possibleTypes": null
}, },
{
"kind": "OBJECT",
"name": "AuditLogConnection",
"description": null,
"fields": [
{
"name": "edges",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "AuditLogEdge",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "pageInfo",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "PageInfo",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "AuditLogEdge",
"description": null,
"fields": [
{
"name": "cursor",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "node",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "AuditLog",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{ {
"kind": "INPUT_OBJECT", "kind": "INPUT_OBJECT",
"name": "AuditLogExportInput", "name": "AuditLogExportInput",
@@ -16607,57 +16424,6 @@
"enumValues": null, "enumValues": null,
"possibleTypes": null "possibleTypes": null
}, },
{
"kind": "INPUT_OBJECT",
"name": "AuditLogFilterInput",
"description": null,
"fields": null,
"inputFields": [
{
"name": "entityTypes",
"description": null,
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "EntityTypeName",
"ofType": null
}
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "mutationTypes",
"description": null,
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "TargetEntityMutationType",
"ofType": null
}
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "AuditLogMutation", "name": "AuditLogMutation",
@@ -22269,22 +22035,6 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "executionBehavior",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "GitHubBuildTriggerExecutionBehavior",
"ofType": null
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "isActive", "name": "isActive",
"description": null, "description": null,
@@ -24434,47 +24184,6 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "mostPopularUpdatesNew",
"description": null,
"args": [
{
"name": "timespan",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "InsightsTimespan",
"ofType": null
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Update",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "uniqueUsersOverTime", "name": "uniqueUsersOverTime",
"description": null, "description": null,
@@ -27127,18 +26836,6 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "isDebugFingerprint",
"description": null,
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "type", "name": "type",
"description": null, "description": null,
@@ -28069,22 +27766,6 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "executionBehavior",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "GitHubBuildTriggerExecutionBehavior",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "id", "name": "id",
"description": null, "description": null,
@@ -28271,29 +27952,6 @@
"enumValues": null, "enumValues": null,
"possibleTypes": null "possibleTypes": null
}, },
{
"kind": "ENUM",
"name": "GitHubBuildTriggerExecutionBehavior",
"description": null,
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "ALWAYS",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "BASE_DIRECTORY_CHANGED",
"description": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "GitHubBuildTriggerMutation", "name": "GitHubBuildTriggerMutation",
@@ -32906,8 +32564,8 @@
"name": "JobRun", "name": "JobRun",
"ofType": null "ofType": null
}, },
"isDeprecated": true, "isDeprecated": false,
"deprecationReason": "No longer supported" "deprecationReason": null
}, },
{ {
"name": "createdAt", "name": "createdAt",
@@ -33204,6 +32862,39 @@
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
},
{
"name": "retryJobRun",
"description": "Retry an EAS Job Run",
"args": [
{
"name": "jobRunId",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "JobRun",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
} }
], ],
"inputFields": null, "inputFields": null,
@@ -36467,41 +36158,6 @@
"enumValues": null, "enumValues": null,
"possibleTypes": null "possibleTypes": null
}, },
{
"kind": "ENUM",
"name": "RequestStatusPattern",
"description": null,
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "HTTP_2XX",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "HTTP_3XX",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "HTTP_4XX",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "HTTP_5XX",
"description": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{ {
"kind": "INPUT_OBJECT", "kind": "INPUT_OBJECT",
"name": "RequestsTimespan", "name": "RequestsTimespan",
@@ -43834,22 +43490,6 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "executionBehavior",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "GitHubBuildTriggerExecutionBehavior",
"ofType": null
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "isActive", "name": "isActive",
"description": null, "description": null,
@@ -49306,22 +48946,6 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "name",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "requestTimestamp", "name": "requestTimestamp",
"description": null, "description": null,
@@ -49337,26 +48961,6 @@
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
},
{
"name": "stack",
"description": null,
"args": [],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
},
"isDeprecated": false,
"deprecationReason": null
} }
], ],
"inputFields": null, "inputFields": null,
@@ -50039,89 +49643,6 @@
"enumValues": null, "enumValues": null,
"possibleTypes": null "possibleTypes": null
}, },
{
"kind": "INPUT_OBJECT",
"name": "WorkerDeploymentRequestsFilter",
"description": null,
"fields": null,
"inputFields": [
{
"name": "methods",
"description": null,
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "pathname",
"description": null,
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "statusCodes",
"description": null,
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "statusPatterns",
"description": null,
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "RequestStatusPattern",
"ofType": null
}
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "WorkerDeploymentsConnection", "name": "WorkerDeploymentsConnection",
+1 -1
View File
@@ -107,7 +107,7 @@ export async function prepareAndroidBuildAsync(
? false ? false
: ctx.buildProfile.autoIncrement, : ctx.buildProfile.autoIncrement,
vcsClient: ctx.vcsClient, vcsClient: ctx.vcsClient,
env: ctx.env, env: ctx.buildProfile.env,
}); });
}, },
prepareJobAsync: async ( prepareJobAsync: async (
+2 -2
View File
@@ -186,7 +186,7 @@ export async function prepareBuildRequestForPlatformAsync<
return async () => { return async () => {
if (ctx.localBuildOptions.localBuildMode === LocalBuildMode.LOCAL_BUILD_PLUGIN) { if (ctx.localBuildOptions.localBuildMode === LocalBuildMode.LOCAL_BUILD_PLUGIN) {
await runLocalBuildAsync(job, metadata, ctx.localBuildOptions, ctx.env); await runLocalBuildAsync(job, metadata, ctx.localBuildOptions);
return undefined; return undefined;
} else if (ctx.localBuildOptions.localBuildMode === LocalBuildMode.INTERNAL) { } else if (ctx.localBuildOptions.localBuildMode === LocalBuildMode.INTERNAL) {
await BuildMutation.updateBuildMetadataAsync(ctx.graphqlClient, { await BuildMutation.updateBuildMetadataAsync(ctx.graphqlClient, {
@@ -676,7 +676,7 @@ async function createAndMaybeUploadFingerprintAsync<T extends Platform>(
platform: ctx.platform, platform: ctx.platform,
workflow: ctx.workflow, workflow: ctx.workflow,
projectDir: ctx.projectDir, projectDir: ctx.projectDir,
env: ctx.env, env: ctx.buildProfile.env,
cwd: ctx.projectDir, cwd: ctx.projectDir,
}); });
-1
View File
@@ -63,5 +63,4 @@ export interface BuildContext<T extends Platform> {
vcsClient: Client; vcsClient: Client;
loggerLevel?: LoggerLevel; loggerLevel?: LoggerLevel;
repack: boolean; repack: boolean;
env: Record<string, string>;
} }
+2 -7
View File
@@ -43,7 +43,6 @@ export async function createBuildContextAsync<T extends Platform>({
buildLoggerLevel, buildLoggerLevel,
freezeCredentials, freezeCredentials,
repack, repack,
env,
}: { }: {
buildProfileName: string; buildProfileName: string;
buildProfile: BuildProfile<T>; buildProfile: BuildProfile<T>;
@@ -65,11 +64,8 @@ export async function createBuildContextAsync<T extends Platform>({
buildLoggerLevel?: LoggerLevel; buildLoggerLevel?: LoggerLevel;
freezeCredentials: boolean; freezeCredentials: boolean;
repack: boolean; repack: boolean;
env: Record<string, string>;
}): Promise<BuildContext<T>> { }): Promise<BuildContext<T>> {
const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({ const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({ env: buildProfile.env });
env,
});
const projectName = exp.slug; const projectName = exp.slug;
const account = await getOwnerAccountForProjectIdAsync(graphqlClient, projectId); const account = await getOwnerAccountForProjectIdAsync(graphqlClient, projectId);
const workflow = await resolveWorkflowAsync(projectDir, platform, vcsClient); const workflow = await resolveWorkflowAsync(projectDir, platform, vcsClient);
@@ -91,7 +87,7 @@ export async function createBuildContextAsync<T extends Platform>({
user: actor, user: actor,
graphqlClient, graphqlClient,
analytics, analytics,
env, env: buildProfile.env,
easJsonCliConfig, easJsonCliConfig,
vcsClient, vcsClient,
freezeCredentials, freezeCredentials,
@@ -151,7 +147,6 @@ export async function createBuildContextAsync<T extends Platform>({
requiredPackageManager, requiredPackageManager,
loggerLevel: buildLoggerLevel, loggerLevel: buildLoggerLevel,
repack, repack,
env,
}; };
if (platform === Platform.ANDROID) { if (platform === Platform.ANDROID) {
const common = commonContext as CommonContext<Platform.ANDROID>; const common = commonContext as CommonContext<Platform.ANDROID>;
@@ -1,81 +0,0 @@
import { Env } from '@expo/eas-build-job';
import { BuildProfile } from '@expo/eas-json';
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
import { EnvironmentVariableEnvironment } from '../graphql/generated';
import { EnvironmentVariablesQuery } from '../graphql/queries/EnvironmentVariablesQuery';
import Log from '../log';
function isEnvironment(env: string): env is EnvironmentVariableEnvironment {
return Object.values(EnvironmentVariableEnvironment).includes(
env.toUpperCase() as EnvironmentVariableEnvironment
);
}
export async function evaluateConfigWithEnvVarsAsync<Config extends { projectId: string }, Opts>({
flags,
buildProfile,
graphqlClient,
getProjectConfig,
opts,
}: {
flags: { environment?: string };
buildProfile: BuildProfile;
graphqlClient: ExpoGraphqlClient | null;
opts: Opts;
getProjectConfig(opts: Opts): Promise<Config>;
}): Promise<Config & { env: Env }> {
if (!graphqlClient) {
Log.warn('An Expo user account is required to fetch environment variables.');
const config = await getProjectConfig(opts);
return { env: buildProfile.env ?? {}, ...config };
}
const { projectId } = await getProjectConfig({ env: buildProfile.env, ...opts });
const env = await resolveEnvVarsAsync({ flags, buildProfile, graphqlClient, projectId });
const config = await getProjectConfig({ ...opts, env });
return { env, ...config };
}
async function resolveEnvVarsAsync({
flags,
buildProfile,
graphqlClient,
projectId,
}: {
flags: { environment?: string };
buildProfile: BuildProfile;
graphqlClient: ExpoGraphqlClient;
projectId: string;
}): Promise<Env> {
const environment =
flags.environment ?? buildProfile.environment ?? process.env.EAS_CURRENT_ENVIRONMENT;
if (!environment || !isEnvironment(environment)) {
return { ...buildProfile.env };
}
try {
const environmentVariables = await EnvironmentVariablesQuery.byAppIdWithSensitiveAsync(
graphqlClient,
{
appId: projectId,
environment,
}
);
const envVars = Object.fromEntries(
environmentVariables
.filter(({ name, value }) => name && value)
.map(({ name, value }) => [name, value])
) as Record<string, string>;
return { ...envVars, ...buildProfile.env };
} catch (e) {
Log.error('Failed to pull env variables for environment ${environment} from EAS servers');
Log.error(e);
Log.error(
'This can possibly be a bug in EAS/EAS CLI. Report it here: https://github.com/expo/eas-cli/issues'
);
return { ...buildProfile.env };
}
}
+3 -3
View File
@@ -24,7 +24,7 @@ import {
export async function createIosContextAsync( export async function createIosContextAsync(
ctx: CommonContext<Platform.IOS> ctx: CommonContext<Platform.IOS>
): Promise<IosBuildContext> { ): Promise<IosBuildContext> {
const { buildProfile, env } = ctx; const { buildProfile } = ctx;
if (ctx.workflow === Workflow.MANAGED) { if (ctx.workflow === Workflow.MANAGED) {
await ensureBundleIdentifierIsDefinedForManagedProjectAsync(ctx); await ensureBundleIdentifierIsDefinedForManagedProjectAsync(ctx);
@@ -47,7 +47,7 @@ export async function createIosContextAsync(
projectDir: ctx.projectDir, projectDir: ctx.projectDir,
exp: ctx.exp, exp: ctx.exp,
xcodeBuildContext, xcodeBuildContext,
env, env: buildProfile.env,
vcsClient: ctx.vcsClient, vcsClient: ctx.vcsClient,
}); });
const applicationTarget = findApplicationTarget(targets); const applicationTarget = findApplicationTarget(targets);
@@ -89,7 +89,7 @@ export async function prepareIosBuildAsync(
? false ? false
: ctx.buildProfile.autoIncrement, : ctx.buildProfile.autoIncrement,
vcsClient: ctx.vcsClient, vcsClient: ctx.vcsClient,
env: ctx.env, env: ctx.buildProfile.env,
}); });
}, },
prepareJobAsync: async ( prepareJobAsync: async (
+1 -3
View File
@@ -39,8 +39,7 @@ export interface LocalBuildOptions {
export async function runLocalBuildAsync( export async function runLocalBuildAsync(
job: Job, job: Job,
metadata: Metadata, metadata: Metadata,
options: LocalBuildOptions, options: LocalBuildOptions
env: Record<string, string>
): Promise<void> { ): Promise<void> {
const { command, args } = await getCommandAndArgsAsync(job, metadata); const { command, args } = await getCommandAndArgsAsync(job, metadata);
let spinner; let spinner;
@@ -58,7 +57,6 @@ export async function runLocalBuildAsync(
const spawnPromise = spawnAsync(command, args, { const spawnPromise = spawnAsync(command, args, {
stdio: options.verbose ? 'inherit' : 'pipe', stdio: options.verbose ? 'inherit' : 'pipe',
env: { env: {
...env,
...process.env, ...process.env,
EAS_LOCAL_BUILD_WORKINGDIR: options.workingdir ?? process.env.EAS_LOCAL_BUILD_WORKINGDIR, EAS_LOCAL_BUILD_WORKINGDIR: options.workingdir ?? process.env.EAS_LOCAL_BUILD_WORKINGDIR,
...(options.skipCleanup || options.skipNativeBuild ...(options.skipCleanup || options.skipNativeBuild
+12 -23
View File
@@ -2,6 +2,7 @@ import { ExpoConfig } from '@expo/config-types';
import { Env, Platform, Workflow } from '@expo/eas-build-job'; import { Env, Platform, Workflow } from '@expo/eas-build-job';
import { import {
AppVersionSource, AppVersionSource,
BuildProfile,
EasJson, EasJson,
EasJsonAccessor, EasJsonAccessor,
EasJsonUtils, EasJsonUtils,
@@ -18,7 +19,6 @@ import { BuildRequestSender, MaybeBuildFragment, waitForBuildEndAsync } from './
import { ensureProjectConfiguredAsync } from './configure'; import { ensureProjectConfiguredAsync } from './configure';
import { BuildContext } from './context'; import { BuildContext } from './context';
import { createBuildContextAsync } from './createContext'; import { createBuildContextAsync } from './createContext';
import { evaluateConfigWithEnvVarsAsync } from './evaluateConfigWithEnvVarsAsync';
import { prepareIosBuildAsync } from './ios/build'; import { prepareIosBuildAsync } from './ios/build';
import { LocalBuildMode, LocalBuildOptions } from './local'; import { LocalBuildMode, LocalBuildOptions } from './local';
import { ensureExpoDevClientInstalledForDevClientBuildsAsync } from './utils/devClient'; import { ensureExpoDevClientInstalledForDevClientBuildsAsync } from './utils/devClient';
@@ -33,7 +33,6 @@ import {
BuildFragment, BuildFragment,
BuildStatus, BuildStatus,
BuildWithSubmissionsFragment, BuildWithSubmissionsFragment,
EnvironmentVariableEnvironment,
SubmissionFragment, SubmissionFragment,
} from '../graphql/generated'; } from '../graphql/generated';
import { BuildQuery } from '../graphql/queries/BuildQuery'; import { BuildQuery } from '../graphql/queries/BuildQuery';
@@ -97,7 +96,6 @@ export interface BuildFlags {
buildLoggerLevel?: LoggerLevel; buildLoggerLevel?: LoggerLevel;
freezeCredentials: boolean; freezeCredentials: boolean;
repack: boolean; repack: boolean;
environment?: EnvironmentVariableEnvironment;
} }
export async function runBuildAndSubmitAsync( export async function runBuildAndSubmitAsync(
@@ -131,6 +129,13 @@ export async function runBuildAndSubmitAsync(
profileName: flags.profile ?? undefined, profileName: flags.profile ?? undefined,
projectDir, projectDir,
}); });
Log.log(
`Loaded "env" configuration for the "${buildProfiles[0].profileName}" profile: ${
buildProfiles[0].profile.env
? Object.keys(buildProfiles[0].profile.env).join(', ')
: 'no environment variables specified'
}. ${learnMore('https://docs.expo.dev/build-reference/variables/')}`
);
for (const buildProfile of buildProfiles) { for (const buildProfile of buildProfiles) {
if (buildProfile.profile.image && ['default', 'stable'].includes(buildProfile.profile.image)) { if (buildProfile.profile.image && ['default', 'stable'].includes(buildProfile.profile.image)) {
@@ -187,21 +192,6 @@ export async function runBuildAndSubmitAsync(
for (const buildProfile of buildProfiles) { for (const buildProfile of buildProfiles) {
const platform = toAppPlatform(buildProfile.platform); const platform = toAppPlatform(buildProfile.platform);
const { env } = await evaluateConfigWithEnvVarsAsync({
flags,
buildProfile: buildProfile.profile,
graphqlClient,
getProjectConfig: getDynamicPrivateProjectConfigAsync,
opts: { env: buildProfile.profile.env },
});
Log.log(
`Loaded "env" configuration for the "${buildProfile.profileName}" profile: ${
env ? Object.keys(env).join(', ') : 'no environment variables specified'
}. ${learnMore('https://docs.expo.dev/build-reference/variables/')}`
);
const { build: maybeBuild, buildCtx } = await prepareAndStartBuildAsync({ const { build: maybeBuild, buildCtx } = await prepareAndStartBuildAsync({
projectDir, projectDir,
flags, flags,
@@ -214,7 +204,6 @@ export async function runBuildAndSubmitAsync(
vcsClient, vcsClient,
getDynamicPrivateProjectConfigAsync, getDynamicPrivateProjectConfigAsync,
customBuildConfigMetadata: customBuildConfigMetadataByPlatform[platform], customBuildConfigMetadata: customBuildConfigMetadataByPlatform[platform],
env,
}); });
if (maybeBuild) { if (maybeBuild) {
startedBuilds.push({ build: maybeBuild, buildProfile }); startedBuilds.push({ build: maybeBuild, buildProfile });
@@ -262,6 +251,7 @@ export async function runBuildAndSubmitAsync(
buildCtx: nullthrows(buildCtxByPlatform[startedBuild.build.platform]), buildCtx: nullthrows(buildCtxByPlatform[startedBuild.build.platform]),
moreBuilds: startedBuilds.length > 1, moreBuilds: startedBuilds.length > 1,
projectDir, projectDir,
buildProfile: startedBuild.buildProfile.profile,
submitProfile, submitProfile,
nonInteractive: flags.nonInteractive, nonInteractive: flags.nonInteractive,
selectedSubmitProfileName: flags.submitProfile, selectedSubmitProfileName: flags.submitProfile,
@@ -350,7 +340,6 @@ async function prepareAndStartBuildAsync({
vcsClient, vcsClient,
getDynamicPrivateProjectConfigAsync, getDynamicPrivateProjectConfigAsync,
customBuildConfigMetadata, customBuildConfigMetadata,
env,
}: { }: {
projectDir: string; projectDir: string;
flags: BuildFlags; flags: BuildFlags;
@@ -363,7 +352,6 @@ async function prepareAndStartBuildAsync({
vcsClient: Client; vcsClient: Client;
getDynamicPrivateProjectConfigAsync: DynamicConfigContextFn; getDynamicPrivateProjectConfigAsync: DynamicConfigContextFn;
customBuildConfigMetadata?: CustomBuildConfigMetadata; customBuildConfigMetadata?: CustomBuildConfigMetadata;
env: Env;
}): Promise<{ build: BuildFragment | undefined; buildCtx: BuildContext<Platform> }> { }): Promise<{ build: BuildFragment | undefined; buildCtx: BuildContext<Platform> }> {
const buildCtx = await createBuildContextAsync({ const buildCtx = await createBuildContextAsync({
buildProfileName: buildProfile.profileName, buildProfileName: buildProfile.profileName,
@@ -386,7 +374,6 @@ async function prepareAndStartBuildAsync({
buildLoggerLevel: flags.buildLoggerLevel, buildLoggerLevel: flags.buildLoggerLevel,
freezeCredentials: flags.freezeCredentials, freezeCredentials: flags.freezeCredentials,
repack: flags.repack, repack: flags.repack,
env,
}); });
if (moreBuilds) { if (moreBuilds) {
@@ -461,6 +448,7 @@ async function prepareAndStartSubmissionAsync({
buildCtx, buildCtx,
moreBuilds, moreBuilds,
projectDir, projectDir,
buildProfile,
submitProfile, submitProfile,
selectedSubmitProfileName, selectedSubmitProfileName,
nonInteractive, nonInteractive,
@@ -469,6 +457,7 @@ async function prepareAndStartSubmissionAsync({
buildCtx: BuildContext<Platform>; buildCtx: BuildContext<Platform>;
moreBuilds: boolean; moreBuilds: boolean;
projectDir: string; projectDir: string;
buildProfile: BuildProfile;
submitProfile: SubmitProfile; submitProfile: SubmitProfile;
selectedSubmitProfileName?: string; selectedSubmitProfileName?: string;
nonInteractive: boolean; nonInteractive: boolean;
@@ -480,7 +469,7 @@ async function prepareAndStartSubmissionAsync({
profile: submitProfile, profile: submitProfile,
archiveFlags: { id: build.id }, archiveFlags: { id: build.id },
nonInteractive, nonInteractive,
env: buildCtx.env, env: buildProfile.env,
credentialsCtx: buildCtx.credentialsCtx, credentialsCtx: buildCtx.credentialsCtx,
applicationIdentifier: buildCtx.android?.applicationId ?? buildCtx.ios?.bundleIdentifier, applicationIdentifier: buildCtx.android?.applicationId ?? buildCtx.ios?.bundleIdentifier,
actor: buildCtx.user, actor: buildCtx.user,
+2 -2
View File
@@ -9,9 +9,9 @@ import Log, { learnMore } from '../log';
import { isPNGAsync } from '../utils/image'; import { isPNGAsync } from '../utils/image';
export function checkNodeEnvVariable(ctx: CommonContext<Platform>): void { export function checkNodeEnvVariable(ctx: CommonContext<Platform>): void {
if (ctx.env?.NODE_ENV === 'production') { if (ctx.buildProfile.env?.NODE_ENV === 'production') {
Log.warn( Log.warn(
'You set NODE_ENV=production in the build profile or environment variables. Remember that it will be available during the entire build process. In particular, it will make yarn/npm install only production packages.' 'You set NODE_ENV=production in the build profile. Remember that it will be available during the entire build process. In particular, it will make yarn/npm install only production packages.'
); );
Log.newLine(); Log.newLine();
} }
@@ -38,21 +38,6 @@ export const EASEnvironmentFlag = {
}), }),
}; };
// NOTE: Used in build commands, should be replaced with EASEnvironmentFlag when
// the feature is public
export const EASEnvironmentFlagHidden = {
environment: Flags.enum<EnvironmentVariableEnvironment>({
description: "Environment variable's environment",
parse: upperCaseAsync,
hidden: true,
options: mapToLowercase([
EnvironmentVariableEnvironment.Development,
EnvironmentVariableEnvironment.Preview,
EnvironmentVariableEnvironment.Production,
]),
}),
};
export const EASVariableFormatFlag = { export const EASVariableFormatFlag = {
format: Flags.enum({ format: Flags.enum({
description: 'Output format', description: 'Output format',
+2 -6
View File
@@ -10,8 +10,8 @@ import path from 'path';
import { LocalBuildMode } from '../../build/local'; import { LocalBuildMode } from '../../build/local';
import { BuildFlags, runBuildAndSubmitAsync } from '../../build/runBuildAndSubmit'; import { BuildFlags, runBuildAndSubmitAsync } from '../../build/runBuildAndSubmit';
import EasCommand from '../../commandUtils/EasCommand'; import EasCommand from '../../commandUtils/EasCommand';
import { EASEnvironmentFlagHidden, EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags'; import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
import { EnvironmentVariableEnvironment, StatuspageServiceName } from '../../graphql/generated'; import { StatuspageServiceName } from '../../graphql/generated';
import Log, { link } from '../../log'; import Log, { link } from '../../log';
import { RequestedPlatform, selectRequestedPlatformAsync } from '../../platform'; import { RequestedPlatform, selectRequestedPlatformAsync } from '../../platform';
import { selectAsync } from '../../prompts'; import { selectAsync } from '../../prompts';
@@ -37,7 +37,6 @@ interface RawBuildFlags {
'build-logger-level'?: LoggerLevel; 'build-logger-level'?: LoggerLevel;
'freeze-credentials': boolean; 'freeze-credentials': boolean;
repack: boolean; repack: boolean;
environment?: EnvironmentVariableEnvironment;
} }
export default class Build extends EasCommand { export default class Build extends EasCommand {
@@ -117,14 +116,12 @@ export default class Build extends EasCommand {
description: 'Use the golden dev client build repack flow as it works for onboarding', description: 'Use the golden dev client build repack flow as it works for onboarding',
}), }),
...EasNonInteractiveAndJsonFlags, ...EasNonInteractiveAndJsonFlags,
...EASEnvironmentFlagHidden,
}; };
static override contextDefinition = { static override contextDefinition = {
...this.ContextOptions.LoggedIn, ...this.ContextOptions.LoggedIn,
...this.ContextOptions.DynamicProjectConfig, ...this.ContextOptions.DynamicProjectConfig,
...this.ContextOptions.ProjectDir, ...this.ContextOptions.ProjectDir,
...this.ContextOptions.ProjectConfig,
...this.ContextOptions.Analytics, ...this.ContextOptions.Analytics,
...this.ContextOptions.Vcs, ...this.ContextOptions.Vcs,
}; };
@@ -233,7 +230,6 @@ export default class Build extends EasCommand {
buildLoggerLevel: flags['build-logger-level'], buildLoggerLevel: flags['build-logger-level'],
freezeCredentials: flags['freeze-credentials'], freezeCredentials: flags['freeze-credentials'],
repack: flags.repack, repack: flags.repack,
environment: flags.environment,
}; };
} }
+4 -18
View File
@@ -6,14 +6,13 @@ import chalk from 'chalk';
import { handleDeprecatedEasJsonAsync } from '.'; import { handleDeprecatedEasJsonAsync } from '.';
import { waitForBuildEndAsync } from '../../build/build'; import { waitForBuildEndAsync } from '../../build/build';
import { evaluateConfigWithEnvVarsAsync } from '../../build/evaluateConfigWithEnvVarsAsync';
import { ensureIosCredentialsForBuildResignAsync } from '../../build/ios/credentials'; import { ensureIosCredentialsForBuildResignAsync } from '../../build/ios/credentials';
import { prepareCredentialsToResign } from '../../build/ios/prepareJob'; import { prepareCredentialsToResign } from '../../build/ios/prepareJob';
import { listAndSelectBuildOnAppAsync } from '../../build/queries'; import { listAndSelectBuildOnAppAsync } from '../../build/queries';
import { printBuildResults, printLogsUrls } from '../../build/utils/printBuildInfo'; import { printBuildResults, printLogsUrls } from '../../build/utils/printBuildInfo';
import EasCommand from '../../commandUtils/EasCommand'; import EasCommand from '../../commandUtils/EasCommand';
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient'; import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
import { EASEnvironmentFlagHidden, EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags'; import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
import { EasPaginatedQueryFlags } from '../../commandUtils/pagination'; import { EasPaginatedQueryFlags } from '../../commandUtils/pagination';
import { CredentialsContext } from '../../credentials/context'; import { CredentialsContext } from '../../credentials/context';
import { import {
@@ -22,7 +21,6 @@ import {
BuildStatus, BuildStatus,
BuildWorkflow, BuildWorkflow,
DistributionType, DistributionType,
EnvironmentVariableEnvironment,
IosJobOverridesInput, IosJobOverridesInput,
ProjectArchiveSourceType, ProjectArchiveSourceType,
StatuspageServiceName, StatuspageServiceName,
@@ -48,7 +46,6 @@ interface BuildResignFlags {
sourceProfile?: string; sourceProfile?: string;
maybeBuildId?: string; maybeBuildId?: string;
wait: boolean; wait: boolean;
environment?: EnvironmentVariableEnvironment;
} }
interface RawBuildResignFlags { interface RawBuildResignFlags {
json: boolean; json: boolean;
@@ -60,7 +57,6 @@ interface RawBuildResignFlags {
'source-profile': string | undefined; 'source-profile': string | undefined;
wait: boolean; wait: boolean;
id: string | undefined; id: string | undefined;
environment: EnvironmentVariableEnvironment | undefined;
} }
export default class BuildResign extends EasCommand { export default class BuildResign extends EasCommand {
@@ -93,7 +89,6 @@ export default class BuildResign extends EasCommand {
}), }),
...EasPaginatedQueryFlags, ...EasPaginatedQueryFlags,
...EasNonInteractiveAndJsonFlags, ...EasNonInteractiveAndJsonFlags,
...EASEnvironmentFlagHidden,
}; };
static override contextDefinition = { static override contextDefinition = {
@@ -145,15 +140,7 @@ export default class BuildResign extends EasCommand {
platform, platform,
flags.targetProfile ?? 'production' flags.targetProfile ?? 'production'
); );
const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({ env: buildProfile.env });
const { exp, projectId, env } = await evaluateConfigWithEnvVarsAsync({
flags,
buildProfile,
graphqlClient,
getProjectConfig: getDynamicPrivateProjectConfigAsync,
opts: { env: buildProfile.env },
});
const account = await getOwnerAccountForProjectIdAsync(graphqlClient, projectId); const account = await getOwnerAccountForProjectIdAsync(graphqlClient, projectId);
const build = await this.ensureBuildSelectedAsync( const build = await this.ensureBuildSelectedAsync(
{ {
@@ -174,7 +161,7 @@ export default class BuildResign extends EasCommand {
user: actor, user: actor,
graphqlClient, graphqlClient,
analytics, analytics,
env, env: buildProfile.env,
easJsonCliConfig, easJsonCliConfig,
vcsClient, vcsClient,
}); });
@@ -194,7 +181,7 @@ export default class BuildResign extends EasCommand {
projectDir, projectDir,
exp, exp,
xcodeBuildContext, xcodeBuildContext,
env, env: buildProfile.env,
vcsClient, vcsClient,
}); });
const credentialsResult = await ensureIosCredentialsForBuildResignAsync( const credentialsResult = await ensureIosCredentialsForBuildResignAsync(
@@ -261,7 +248,6 @@ export default class BuildResign extends EasCommand {
targetProfile: flags['target-profile'], targetProfile: flags['target-profile'],
maybeBuildId: flags.id, maybeBuildId: flags.id,
wait: flags.wait, wait: flags.wait,
environment: flags.environment,
}; };
} }
@@ -3,12 +3,8 @@ import { EasJsonAccessor } from '@expo/eas-json';
import { Flags } from '@oclif/core'; import { Flags } from '@oclif/core';
import chalk from 'chalk'; import chalk from 'chalk';
import { evaluateConfigWithEnvVarsAsync } from '../../../build/evaluateConfigWithEnvVarsAsync';
import EasCommand from '../../../commandUtils/EasCommand'; import EasCommand from '../../../commandUtils/EasCommand';
import { import { EasNonInteractiveAndJsonFlags } from '../../../commandUtils/flags';
EASEnvironmentFlagHidden,
EasNonInteractiveAndJsonFlags,
} from '../../../commandUtils/flags';
import { AppVersionQuery } from '../../../graphql/queries/AppVersionQuery'; import { AppVersionQuery } from '../../../graphql/queries/AppVersionQuery';
import { toAppPlatform } from '../../../graphql/types/AppPlatform'; import { toAppPlatform } from '../../../graphql/types/AppPlatform';
import Log from '../../../log'; import Log from '../../../log';
@@ -35,7 +31,6 @@ export default class BuildVersionGetView extends EasCommand {
'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.', 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
helpValue: 'PROFILE_NAME', helpValue: 'PROFILE_NAME',
}), }),
...EASEnvironmentFlagHidden,
...EasNonInteractiveAndJsonFlags, ...EasNonInteractiveAndJsonFlags,
}; };
@@ -79,12 +74,8 @@ export default class BuildVersionGetView extends EasCommand {
}); });
const results: { [key in Platform]?: string } = {}; const results: { [key in Platform]?: string } = {};
for (const { profile, platform } of buildProfiles) { for (const { profile, platform } of buildProfiles) {
const { exp, projectId, env } = await evaluateConfigWithEnvVarsAsync({ const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({
flags, env: profile.env,
buildProfile: profile,
graphqlClient,
getProjectConfig: getDynamicPrivateProjectConfigAsync,
opts: { env: profile.env },
}); });
validateAppConfigForRemoteVersionSource(exp, platform); validateAppConfigForRemoteVersionSource(exp, platform);
@@ -98,7 +89,6 @@ export default class BuildVersionGetView extends EasCommand {
platform, platform,
vcsClient, vcsClient,
nonInteractive: flags['non-interactive'], nonInteractive: flags['non-interactive'],
env,
}); });
const remoteVersions = await AppVersionQuery.latestVersionAsync( const remoteVersions = await AppVersionQuery.latestVersionAsync(
graphqlClient, graphqlClient,
@@ -4,9 +4,7 @@ import { EasJsonAccessor, EasJsonUtils } from '@expo/eas-json';
import { Flags } from '@oclif/core'; import { Flags } from '@oclif/core';
import chalk from 'chalk'; import chalk from 'chalk';
import { evaluateConfigWithEnvVarsAsync } from '../../../build/evaluateConfigWithEnvVarsAsync';
import EasCommand from '../../../commandUtils/EasCommand'; import EasCommand from '../../../commandUtils/EasCommand';
import { EASEnvironmentFlagHidden } from '../../../commandUtils/flags';
import { AppVersionMutation } from '../../../graphql/mutations/AppVersionMutation'; import { AppVersionMutation } from '../../../graphql/mutations/AppVersionMutation';
import { AppVersionQuery } from '../../../graphql/queries/AppVersionQuery'; import { AppVersionQuery } from '../../../graphql/queries/AppVersionQuery';
import { toAppPlatform } from '../../../graphql/types/AppPlatform'; import { toAppPlatform } from '../../../graphql/types/AppPlatform';
@@ -37,7 +35,6 @@ export default class BuildVersionSetView extends EasCommand {
'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.', 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
helpValue: 'PROFILE_NAME', helpValue: 'PROFILE_NAME',
}), }),
...EASEnvironmentFlagHidden,
}; };
static override contextDefinition = { static override contextDefinition = {
@@ -67,13 +64,7 @@ export default class BuildVersionSetView extends EasCommand {
flags.profile ?? undefined flags.profile ?? undefined
); );
const { exp, projectId, env } = await evaluateConfigWithEnvVarsAsync({ const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({ env: profile.env });
flags,
buildProfile: profile,
graphqlClient,
getProjectConfig: getDynamicPrivateProjectConfigAsync,
opts: { env: profile.env },
});
const displayName = await getDisplayNameForProjectIdAsync(graphqlClient, projectId); const displayName = await getDisplayNameForProjectIdAsync(graphqlClient, projectId);
validateAppConfigForRemoteVersionSource(exp, platform); validateAppConfigForRemoteVersionSource(exp, platform);
@@ -87,7 +78,6 @@ export default class BuildVersionSetView extends EasCommand {
platform, platform,
vcsClient, vcsClient,
nonInteractive: false, nonInteractive: false,
env,
}); });
const remoteVersions = await AppVersionQuery.latestVersionAsync( const remoteVersions = await AppVersionQuery.latestVersionAsync(
graphqlClient, graphqlClient,
@@ -5,10 +5,8 @@ import { Flags } from '@oclif/core';
import chalk from 'chalk'; import chalk from 'chalk';
import { updateNativeVersionsAsync as updateAndroidNativeVersionsAsync } from '../../../build/android/version'; import { updateNativeVersionsAsync as updateAndroidNativeVersionsAsync } from '../../../build/android/version';
import { evaluateConfigWithEnvVarsAsync } from '../../../build/evaluateConfigWithEnvVarsAsync';
import { updateNativeVersionsAsync as updateIosNativeVersionsAsync } from '../../../build/ios/version'; import { updateNativeVersionsAsync as updateIosNativeVersionsAsync } from '../../../build/ios/version';
import EasCommand from '../../../commandUtils/EasCommand'; import EasCommand from '../../../commandUtils/EasCommand';
import { EASEnvironmentFlagHidden } from '../../../commandUtils/flags';
import { AppVersionQuery } from '../../../graphql/queries/AppVersionQuery'; import { AppVersionQuery } from '../../../graphql/queries/AppVersionQuery';
import { toAppPlatform } from '../../../graphql/types/AppPlatform'; import { toAppPlatform } from '../../../graphql/types/AppPlatform';
import Log from '../../../log'; import Log from '../../../log';
@@ -56,7 +54,6 @@ export default class BuildVersionSyncView extends EasCommand {
'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.', 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
helpValue: 'PROFILE_NAME', helpValue: 'PROFILE_NAME',
}), }),
...EASEnvironmentFlagHidden,
}; };
static override contextDefinition = { static override contextDefinition = {
@@ -90,12 +87,8 @@ export default class BuildVersionSyncView extends EasCommand {
projectDir, projectDir,
}); });
for (const profileInfo of buildProfiles) { for (const profileInfo of buildProfiles) {
const { exp, projectId, env } = await evaluateConfigWithEnvVarsAsync({ const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({
flags, env: profileInfo.profile.env,
buildProfile: profileInfo.profile,
graphqlClient,
getProjectConfig: getDynamicPrivateProjectConfigAsync,
opts: { env: profileInfo.profile.env },
}); });
validateAppConfigForRemoteVersionSource(exp, profileInfo.platform); validateAppConfigForRemoteVersionSource(exp, profileInfo.platform);
@@ -110,7 +103,6 @@ export default class BuildVersionSyncView extends EasCommand {
platform: profileInfo.platform, platform: profileInfo.platform,
vcsClient, vcsClient,
nonInteractive: false, nonInteractive: false,
env,
}); });
const remoteVersions = await AppVersionQuery.latestVersionAsync( const remoteVersions = await AppVersionQuery.latestVersionAsync(
graphqlClient, graphqlClient,
+7 -24
View File
@@ -4,10 +4,8 @@ import { EasJsonAccessor, EasJsonUtils } from '@expo/eas-json';
import { Flags } from '@oclif/core'; import { Flags } from '@oclif/core';
import chalk from 'chalk'; import chalk from 'chalk';
import { evaluateConfigWithEnvVarsAsync } from '../build/evaluateConfigWithEnvVarsAsync';
import EasCommand from '../commandUtils/EasCommand'; import EasCommand from '../commandUtils/EasCommand';
import { createGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient'; import { EasNonInteractiveAndJsonFlags } from '../commandUtils/flags';
import { EASEnvironmentFlagHidden, EasNonInteractiveAndJsonFlags } from '../commandUtils/flags';
import { toAppPlatform } from '../graphql/types/AppPlatform'; import { toAppPlatform } from '../graphql/types/AppPlatform';
import Log from '../log'; import Log from '../log';
import { appPlatformEmojis } from '../platform'; import { appPlatformEmojis } from '../platform';
@@ -29,14 +27,12 @@ export default class Config extends EasCommand {
'eas-json-only': Flags.boolean({ 'eas-json-only': Flags.boolean({
hidden: true, hidden: true,
}), }),
...EASEnvironmentFlagHidden,
...EasNonInteractiveAndJsonFlags, ...EasNonInteractiveAndJsonFlags,
}; };
static override contextDefinition = { static override contextDefinition = {
...this.ContextOptions.DynamicProjectConfig, ...this.ContextOptions.DynamicProjectConfig,
...this.ContextOptions.ProjectDir, ...this.ContextOptions.ProjectDir,
...this.ContextOptions.SessionManagment,
}; };
async runAsync(): Promise<void> { async runAsync(): Promise<void> {
@@ -44,15 +40,10 @@ export default class Config extends EasCommand {
if (flags.json) { if (flags.json) {
enableJsonOutput(); enableJsonOutput();
} }
const { const { platform: maybePlatform, profile: maybeProfile } = flags;
platform: maybePlatform, const { getDynamicPublicProjectConfigAsync, projectDir } = await this.getContextAsync(Config, {
profile: maybeProfile, nonInteractive: false,
'non-interactive': nonInteractive, });
} = flags;
const { getDynamicPublicProjectConfigAsync, projectDir, sessionManager } =
await this.getContextAsync(Config, {
nonInteractive,
});
const accessor = EasJsonAccessor.fromProjectPath(projectDir); const accessor = EasJsonAccessor.fromProjectPath(projectDir);
const profileName = const profileName =
@@ -89,16 +80,8 @@ export default class Config extends EasCommand {
Log.log(JSON.stringify(profile, null, 2)); Log.log(JSON.stringify(profile, null, 2));
} }
} else { } else {
const { authenticationInfo } = await sessionManager.ensureLoggedInAsync({ const { exp: appConfig } = await getDynamicPublicProjectConfigAsync({
nonInteractive, env: profile.env,
});
const graphqlClient = createGraphqlClient(authenticationInfo);
const { exp: appConfig } = await evaluateConfigWithEnvVarsAsync({
flags,
buildProfile: profile,
graphqlClient,
getProjectConfig: getDynamicPublicProjectConfigAsync,
opts: { env: profile.env },
}); });
if (flags.json) { if (flags.json) {
+6 -7
View File
@@ -114,10 +114,11 @@ export default class EnvironmentVariableCreate extends EasCommand {
if (!environment) { if (!environment) {
environment = await promptVariableEnvironmentAsync(nonInteractive); environment = await promptVariableEnvironmentAsync(nonInteractive);
} }
const existingVariables = await EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, { const existingVariables = await EnvironmentVariablesQuery.byAppIdAsync(
appId: projectId, graphqlClient,
environment, projectId,
}); environment
);
const existingVariable = existingVariables.find(variable => variable.name === name); const existingVariable = existingVariables.find(variable => variable.name === name);
if (existingVariable) { if (existingVariable) {
@@ -190,9 +191,7 @@ export default class EnvironmentVariableCreate extends EasCommand {
`Created a new variable ${chalk.bold(name)} on project ${chalk.bold(projectDisplayName)}.` `Created a new variable ${chalk.bold(name)} on project ${chalk.bold(projectDisplayName)}.`
); );
} else if (scope === EnvironmentVariableScope.Shared) { } else if (scope === EnvironmentVariableScope.Shared) {
const sharedVariables = await EnvironmentVariablesQuery.sharedAsync(graphqlClient, { const sharedVariables = await EnvironmentVariablesQuery.sharedAsync(graphqlClient, projectId);
appId: projectId,
});
const existingVariable = sharedVariables.find(variable => variable.name === name); const existingVariable = sharedVariables.find(variable => variable.name === name);
if (existingVariable) { if (existingVariable) {
throw new Error( throw new Error(
+2 -5
View File
@@ -58,11 +58,8 @@ export default class EnvironmentVariableDelete extends EasCommand {
const variables = const variables =
scope === EnvironmentVariableScope.Project && environment scope === EnvironmentVariableScope.Project && environment
? await EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, { ? await EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, projectId, environment)
appId: projectId, : await EnvironmentVariablesQuery.sharedAsync(graphqlClient, projectId);
environment,
})
: await EnvironmentVariablesQuery.sharedAsync(graphqlClient, { appId: projectId });
if (!name) { if (!name) {
({ name } = await promptAsync({ ({ name } = await promptAsync({
+10 -15
View File
@@ -72,6 +72,7 @@ export default class EnvironmentVariableGet extends EasCommand {
if (!environment && scope === EnvironmentVariableScope.Project) { if (!environment && scope === EnvironmentVariableScope.Project) {
environment = await promptVariableEnvironmentAsync(nonInteractive); environment = await promptVariableEnvironmentAsync(nonInteractive);
} }
const variable = await getVariableAsync(graphqlClient, scope, projectId, name, environment); const variable = await getVariableAsync(graphqlClient, scope, projectId, name, environment);
if (!variable) { if (!variable) {
@@ -116,32 +117,26 @@ async function getVariableAsync(
graphqlClient: ExpoGraphqlClient, graphqlClient: ExpoGraphqlClient,
scope: string, scope: string,
projectId: string, projectId: string,
name: string | undefined, name: string,
environment: string | undefined environment: string | undefined
): Promise<EnvironmentVariableFragment | null> { ): Promise<EnvironmentVariableFragment | null> {
if (!environment && scope === EnvironmentVariableScope.Project) { if (!environment && scope === EnvironmentVariableScope.Project) {
throw new Error('Environment is required.'); throw new Error('Environment is required.');
} }
if (!name) {
throw new Error("Variable name is required. Run the command with '--name VARIABLE_NAME' flag.");
}
if (environment && scope === EnvironmentVariableScope.Project) { if (environment && scope === EnvironmentVariableScope.Project) {
const appVariables = await EnvironmentVariablesQuery.byAppIdWithSensitiveAsync(graphqlClient, { const appVariables = await EnvironmentVariablesQuery.byAppIdAsync(
appId: projectId, graphqlClient,
projectId,
environment, environment,
filterNames: [name], [name]
}); );
return appVariables[0]; return appVariables[0];
} }
if (scope === EnvironmentVariableScope.Shared) { if (scope === EnvironmentVariableScope.Shared) {
const sharedVariables = await EnvironmentVariablesQuery.sharedWithSensitiveAsync( const sharedVariables = await EnvironmentVariablesQuery.sharedAsync(graphqlClient, projectId, [
graphqlClient, name,
{ ]);
appId: projectId,
filterNames: [name],
}
);
return sharedVariables[0]; return sharedVariables[0];
} }
+1 -3
View File
@@ -40,9 +40,7 @@ export default class EnvironmentVariableLink extends EasCommand {
}); });
const projectDisplayName = await getDisplayNameForProjectIdAsync(graphqlClient, projectId); const projectDisplayName = await getDisplayNameForProjectIdAsync(graphqlClient, projectId);
const variables = await EnvironmentVariablesQuery.sharedAsync(graphqlClient, { const variables = await EnvironmentVariablesQuery.sharedAsync(graphqlClient, projectId);
appId: projectId,
});
if (!name) { if (!name) {
name = await selectAsync( name = await selectAsync(
+6 -52
View File
@@ -1,18 +1,12 @@
import { Flags } from '@oclif/core';
import chalk from 'chalk'; import chalk from 'chalk';
import EasCommand from '../../commandUtils/EasCommand'; import EasCommand from '../../commandUtils/EasCommand';
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
import { import {
EASEnvironmentFlag, EASEnvironmentFlag,
EASVariableFormatFlag, EASVariableFormatFlag,
EASVariableScopeFlag, EASVariableScopeFlag,
} from '../../commandUtils/flags'; } from '../../commandUtils/flags';
import { import { EnvironmentVariableScope } from '../../graphql/generated';
EnvironmentVariableEnvironment,
EnvironmentVariableFragment,
EnvironmentVariableScope,
} from '../../graphql/generated';
import { EnvironmentVariablesQuery } from '../../graphql/queries/EnvironmentVariablesQuery'; import { EnvironmentVariablesQuery } from '../../graphql/queries/EnvironmentVariablesQuery';
import Log from '../../log'; import Log from '../../log';
import { formatVariable } from '../../utils/formatVariable'; import { formatVariable } from '../../utils/formatVariable';
@@ -29,10 +23,6 @@ export default class EnvironmentValueList extends EasCommand {
}; };
static override flags = { static override flags = {
'include-sensitive': Flags.boolean({
description: 'Display sensitive values in the output',
default: false,
}),
...EASVariableFormatFlag, ...EASVariableFormatFlag,
...EASVariableScopeFlag, ...EASVariableScopeFlag,
...EASEnvironmentFlag, ...EASEnvironmentFlag,
@@ -40,7 +30,7 @@ export default class EnvironmentValueList extends EasCommand {
async runAsync(): Promise<void> { async runAsync(): Promise<void> {
let { let {
flags: { environment, format, scope, 'include-sensitive': includeSensitive }, flags: { environment, format, scope },
} = await this.parse(EnvironmentValueList); } = await this.parse(EnvironmentValueList);
const { const {
privateProjectConfig: { projectId }, privateProjectConfig: { projectId },
@@ -53,12 +43,10 @@ export default class EnvironmentValueList extends EasCommand {
environment = await promptVariableEnvironmentAsync(false); environment = await promptVariableEnvironmentAsync(false);
} }
const variables = await this.getVariablesForScopeAsync(graphqlClient, { const variables =
scope, scope === EnvironmentVariableScope.Project && environment
includingSensitive: includeSensitive, ? await EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, projectId, environment)
environment, : await EnvironmentVariablesQuery.sharedAsync(graphqlClient, projectId);
projectId,
});
if (format === 'short') { if (format === 'short') {
for (const variable of variables) { for (const variable of variables) {
@@ -81,38 +69,4 @@ export default class EnvironmentValueList extends EasCommand {
); );
} }
} }
private async getVariablesForScopeAsync(
graphqlClient: ExpoGraphqlClient,
{
scope,
includingSensitive,
environment,
projectId,
}: {
scope: EnvironmentVariableScope;
includingSensitive: boolean;
environment?: EnvironmentVariableEnvironment;
projectId: string;
}
): Promise<EnvironmentVariableFragment[]> {
if (scope === EnvironmentVariableScope.Project && environment) {
if (includingSensitive) {
return await EnvironmentVariablesQuery.byAppIdWithSensitiveAsync(graphqlClient, {
appId: projectId,
environment,
});
}
return await EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, {
appId: projectId,
environment,
});
}
return includingSensitive
? await EnvironmentVariablesQuery.sharedWithSensitiveAsync(graphqlClient, {
appId: projectId,
})
: await EnvironmentVariablesQuery.sharedAsync(graphqlClient, { appId: projectId });
}
} }
-80
View File
@@ -1,80 +0,0 @@
import { Flags } from '@oclif/core';
import * as fs from 'fs-extra';
import EasCommand from '../../commandUtils/EasCommand';
import { EASEnvironmentFlag, EASNonInteractiveFlag } from '../../commandUtils/flags';
import { EnvironmentVariableFragment } from '../../graphql/generated';
import { EnvironmentVariablesQuery } from '../../graphql/queries/EnvironmentVariablesQuery';
import Log from '../../log';
import { confirmAsync } from '../../prompts';
import { promptVariableEnvironmentAsync } from '../../utils/prompts';
export default class EnvironmentValuePull extends EasCommand {
static override description = 'pull env file';
static override hidden = true;
static override contextDefinition = {
...this.ContextOptions.ProjectConfig,
...this.ContextOptions.LoggedIn,
};
static override flags = {
...EASEnvironmentFlag,
...EASNonInteractiveFlag,
path: Flags.string({
description: 'Path to the result `.env` file',
default: '.env.local',
}),
};
async runAsync(): Promise<void> {
let {
flags: { environment, path: targetPath, 'non-interactive': nonInteractive },
} = await this.parse(EnvironmentValuePull);
if (!environment) {
environment = await promptVariableEnvironmentAsync(nonInteractive);
}
const {
privateProjectConfig: { projectId },
loggedIn: { graphqlClient },
} = await this.getContextAsync(EnvironmentValuePull, {
nonInteractive,
});
targetPath = targetPath ?? '.env.local';
const environmentVariables = await EnvironmentVariablesQuery.byAppIdWithSensitiveAsync(
graphqlClient,
{
appId: projectId,
environment,
}
);
if (!nonInteractive && (await fs.exists(targetPath))) {
const result = await confirmAsync({
message: `File ${targetPath} already exists. Do you want to overwrite it?`,
});
if (!result) {
Log.log('Aborting...');
throw new Error(`File ${targetPath} already exists.`);
}
}
const filePrefix = `# Environment: ${environment}\n\n`;
const envFileContent = environmentVariables
.map((variable: EnvironmentVariableFragment) => {
if (variable.value === null) {
return `# ${variable.name}=***** (secret variables are not available for reading)`;
}
return `${variable.name}=${variable.value}`;
})
.join('\n');
await fs.writeFile(targetPath, filePrefix + envFileContent);
Log.log(`Pulled environment variables from ${environment} environment to ${targetPath}.`);
}
}
-210
View File
@@ -1,210 +0,0 @@
import { Flags } from '@oclif/core';
import dotenv from 'dotenv';
import fs from 'fs-extra';
import EasCommand from '../../commandUtils/EasCommand';
import { EASEnvironmentFlag } from '../../commandUtils/flags';
import {
EnvironmentVariableEnvironment,
EnvironmentVariableFragment,
EnvironmentVariableScope,
EnvironmentVariableVisibility,
} from '../../graphql/generated';
import {
EnvironmentVariableMutation,
EnvironmentVariablePushInput,
} from '../../graphql/mutations/EnvironmentVariableMutation';
import { EnvironmentVariablesQuery } from '../../graphql/queries/EnvironmentVariablesQuery';
import Log from '../../log';
import { confirmAsync, promptAsync } from '../../prompts';
type PushFlags = {
environment?: EnvironmentVariableEnvironment;
path: string;
};
export default class EnvironmentVariablePush extends EasCommand {
static override description = 'push env file';
static override hidden = true;
static override contextDefinition = {
...this.ContextOptions.ProjectConfig,
...this.ContextOptions.LoggedIn,
};
static override flags = {
...EASEnvironmentFlag,
path: Flags.string({
description: 'Path to the input `.env` file',
default: '.env.local',
}),
};
async runAsync(): Promise<void> {
const { flags } = await this.parse(EnvironmentVariablePush);
const { environment, path: envPath } = this.validateFlags(flags);
const {
privateProjectConfig: { projectId },
loggedIn: { graphqlClient },
} = await this.getContextAsync(EnvironmentVariablePush, {
nonInteractive: false,
});
const updateVariables: Record<string, EnvironmentVariablePushInput> =
await this.parseEnvFileAsync(envPath, environment);
const variableNames = Object.keys(updateVariables);
const existingVariables = await EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, {
appId: projectId,
environment,
filterNames: variableNames,
});
const existingDifferentVariables: EnvironmentVariableFragment[] = [];
// Remove variables that are the same as the ones in the environment
existingVariables.forEach(variable => {
const existingVariableUpdate = updateVariables[variable.name];
if (existingVariableUpdate && existingVariableUpdate.value !== variable.value) {
existingDifferentVariables.push(variable);
} else {
delete updateVariables[variable.name];
}
});
const existingDifferentSharedVariables = existingDifferentVariables.filter(
variable => variable.scope === EnvironmentVariableScope.Shared
);
if (existingDifferentSharedVariables.length > 0) {
const existingDifferentSharedVariablesNames = existingDifferentSharedVariables.map(
variable => variable.name
);
Log.error('Shared variables cannot be overwritten by eas env:push command.');
Log.error('Remove them from the env file or unlink them from the project to continue:');
existingDifferentSharedVariablesNames.forEach(name => {
Log.error(`- ${name}`);
});
throw new Error('Shared variables cannot be overwritten by eas env:push command');
}
if (existingDifferentVariables.length > 0) {
Log.warn('Some variables already exist in the environment.');
const variableNames = existingDifferentVariables.map(variable => variable.name);
const confirmationMessage =
variableNames.length > 1
? `The ${variableNames.join(
', '
)} environment variables already exist in ${environment} environment. Do you want to override them all?`
: `The ${variableNames[0]} environment variable already exists in ${environment} environment. Do you want to override it?`;
const confirm = await confirmAsync({
message: confirmationMessage,
});
let variablesToOverwrite: string[] = [];
if (!confirm && existingDifferentVariables.length === 1) {
throw new Error('No new variables to push.');
}
if (confirm) {
variablesToOverwrite = existingDifferentVariables.map(variable => variable.name);
} else {
const promptResult = await promptAsync({
type: 'multiselect',
name: 'variablesToOverwrite',
message: 'Select variables to overwrite:',
// @ts-expect-error property missing from `@types/prompts`
optionsPerPage: 20,
choices: existingDifferentVariables.map(variable => ({
title: `${variable.name}: ${updateVariables[variable.name].value} (was ${
variable.value ?? '(secret)'
})`,
value: variable.name,
})),
});
variablesToOverwrite = promptResult.variablesToOverwrite;
}
for (const existingVariable of existingVariables) {
const name = existingVariable.name;
if (variablesToOverwrite.includes(name)) {
updateVariables[name]['overwrite'] = true;
} else {
delete updateVariables[name];
}
}
}
// Check if any of the sensitive variables already exist in the environment. Prompt the user to overwrite them.
const existingSensitiveVariables = existingVariables.filter(
variable => variable.value === null
);
if (existingSensitiveVariables.length > 0) {
const existingSensitiveVariablesNames = existingSensitiveVariables.map(
variable => `- ${variable.name}`
);
const confirm = await confirmAsync({
message: `You are about to overwrite sensitive variables.\n${existingSensitiveVariablesNames.join(
'\n'
)}\n Do you want to continue?`,
});
if (!confirm) {
throw new Error('Aborting...');
}
}
const variablesToPush = Object.values(updateVariables);
if (variablesToPush.length === 0) {
Log.log('No new variables to push.');
return;
}
await EnvironmentVariableMutation.createBulkEnvironmentVariablesForAppAsync(
graphqlClient,
variablesToPush,
projectId
);
Log.log(`Uploaded env file to ${environment} environment.`);
}
private async parseEnvFileAsync(
envPath: string,
environment: string
): Promise<Record<string, EnvironmentVariablePushInput>> {
if (!(await fs.exists(envPath))) {
throw new Error(`File ${envPath} does not exist.`);
}
const pushInput: Record<string, EnvironmentVariablePushInput> = {};
const variables: Record<string, string> = dotenv.parse(await fs.readFile(envPath, 'utf8'));
for (const [name, value] of Object.entries(variables)) {
pushInput[name] = {
name,
value,
environment,
visibility: name.startsWith('EXPO_SENSITIVE')
? EnvironmentVariableVisibility.Sensitive
: EnvironmentVariableVisibility.Public,
};
}
return pushInput;
}
private validateFlags(flags: PushFlags): Required<PushFlags> {
if (!flags.environment) {
throw new Error('Please provide an environment to push the env file to.');
}
return { ...flags, environment: flags.environment };
}
}
+5 -4
View File
@@ -46,10 +46,11 @@ export default class EnvironmentVariableUnlink extends EasCommand {
const projectDisplayName = await getDisplayNameForProjectIdAsync(graphqlClient, projectId); const projectDisplayName = await getDisplayNameForProjectIdAsync(graphqlClient, projectId);
const appVariables = await EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, { const appVariables = await EnvironmentVariablesQuery.byAppIdAsync(
appId: projectId, graphqlClient,
environment, projectId,
}); environment
);
const linkedVariables = appVariables.filter( const linkedVariables = appVariables.filter(
({ scope }) => scope === EnvironmentVariableScope.Shared ({ scope }) => scope === EnvironmentVariableScope.Shared
); );
+6 -7
View File
@@ -80,10 +80,11 @@ export default class EnvironmentVariableUpdate extends EasCommand {
if (!environment) { if (!environment) {
environment = await promptVariableEnvironmentAsync(nonInteractive); environment = await promptVariableEnvironmentAsync(nonInteractive);
} }
const existingVariables = await EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, { const existingVariables = await EnvironmentVariablesQuery.byAppIdAsync(
appId: projectId, graphqlClient,
environment, projectId,
}); environment
);
if (!name) { if (!name) {
name = await selectAsync( name = await selectAsync(
'Select variable', 'Select variable',
@@ -133,9 +134,7 @@ export default class EnvironmentVariableUpdate extends EasCommand {
`Updated variable ${chalk.bold(name)} on project ${chalk.bold(projectDisplayName)}.` `Updated variable ${chalk.bold(name)} on project ${chalk.bold(projectDisplayName)}.`
); );
} else if (scope === EnvironmentVariableScope.Shared) { } else if (scope === EnvironmentVariableScope.Shared) {
const sharedVariables = await EnvironmentVariablesQuery.sharedAsync(graphqlClient, { const sharedVariables = await EnvironmentVariablesQuery.sharedAsync(graphqlClient, projectId);
appId: projectId,
});
if (!name) { if (!name) {
name = await selectAsync( name = await selectAsync(
+892 -6342
View File
File diff suppressed because it is too large. Load diff
@@ -4,7 +4,6 @@ import gql from 'graphql-tag';
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient'; import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
import { withErrorHandlingAsync } from '../client'; import { withErrorHandlingAsync } from '../client';
import { import {
CreateBulkEnvironmentVariablesForAppMutation,
CreateEnvironmentVariableForAccountMutation, CreateEnvironmentVariableForAccountMutation,
CreateEnvironmentVariableForAppMutation, CreateEnvironmentVariableForAppMutation,
DeleteEnvironmentVariableMutation, DeleteEnvironmentVariableMutation,
@@ -197,34 +196,4 @@ export const EnvironmentVariableMutation = {
return data.environmentVariable.deleteEnvironmentVariable; return data.environmentVariable.deleteEnvironmentVariable;
}, },
async createBulkEnvironmentVariablesForAppAsync(
graphqlClient: ExpoGraphqlClient,
input: EnvironmentVariablePushInput[],
appId: string
): Promise<boolean> {
await withErrorHandlingAsync(
graphqlClient
.mutation<CreateBulkEnvironmentVariablesForAppMutation>(
gql`
mutation CreateBulkEnvironmentVariablesForApp(
$input: [CreateEnvironmentVariableInput!]!
$appId: ID!
) {
environmentVariable {
createBulkEnvironmentVariablesForApp(
environmentVariablesData: $input
appId: $appId
) {
id
}
}
}
`,
{ input, appId }
)
.toPromise()
);
return true;
},
}; };
@@ -4,6 +4,7 @@ import gql from 'graphql-tag';
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient'; import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
import { withErrorHandlingAsync } from '../client'; import { withErrorHandlingAsync } from '../client';
import { import {
EnvironmentVariableEnvironment,
EnvironmentVariableFragment, EnvironmentVariableFragment,
EnvironmentVariablesByAppIdQuery, EnvironmentVariablesByAppIdQuery,
EnvironmentVariablesSharedQuery, EnvironmentVariablesSharedQuery,
@@ -20,10 +21,12 @@ export const EnvironmentVariablesQuery = {
filterNames, filterNames,
}: { }: {
appId: string; appId: string;
environment: string; environment: EnvironmentVariableEnvironment;
filterNames?: string[]; filterNames?: string[];
} }
): Promise<EnvironmentVariableFragment[]> { ): Promise<{
appVariables: EnvironmentVariableFragment[];
}> {
const data = await withErrorHandlingAsync( const data = await withErrorHandlingAsync(
graphqlClient graphqlClient
.query( .query(
@@ -49,24 +52,20 @@ export const EnvironmentVariablesQuery = {
} }
`, `,
{ appId, filterNames, environment }, { appId, filterNames, environment },
{ additionalTypenames: ['EnvironmentVariableWithSecret'] } { additionalTypenames: ['EnvironmentVariable'] }
) )
.toPromise() .toPromise()
); );
return data.app?.byId.environmentVariablesIncludingSensitive ?? []; return {
appVariables: data.app?.byId.environmentVariablesIncludingSensitive ?? [],
};
}, },
async byAppIdAsync( async byAppIdAsync(
graphqlClient: ExpoGraphqlClient, graphqlClient: ExpoGraphqlClient,
{ appId: string,
appId, environment: string,
environment, filterNames?: string[]
filterNames,
}: {
appId: string;
environment: string;
filterNames?: string[];
}
): Promise<EnvironmentVariableFragment[]> { ): Promise<EnvironmentVariableFragment[]> {
const data = await withErrorHandlingAsync( const data = await withErrorHandlingAsync(
graphqlClient graphqlClient
@@ -99,7 +98,8 @@ export const EnvironmentVariablesQuery = {
}, },
async sharedAsync( async sharedAsync(
graphqlClient: ExpoGraphqlClient, graphqlClient: ExpoGraphqlClient,
{ appId, filterNames }: { appId: string; filterNames?: string[] } appId: string,
filterNames?: string[]
): Promise<EnvironmentVariableFragment[]> { ): Promise<EnvironmentVariableFragment[]> {
const data = await withErrorHandlingAsync( const data = await withErrorHandlingAsync(
graphqlClient graphqlClient
@@ -129,39 +129,4 @@ export const EnvironmentVariablesQuery = {
return data.app?.byId.ownerAccount.environmentVariables ?? []; return data.app?.byId.ownerAccount.environmentVariables ?? [];
}, },
async sharedWithSensitiveAsync(
graphqlClient: ExpoGraphqlClient,
{ appId, filterNames }: { appId: string; filterNames?: string[] }
): Promise<EnvironmentVariableFragment[]> {
const data = await withErrorHandlingAsync(
graphqlClient
.query(
gql`
query EnvironmentVariablesSharedWithSensitive(
$appId: String!
$filterNames: [String!]
) {
app {
byId(appId: $appId) {
id
ownerAccount {
id
environmentVariablesIncludingSensitive(filterNames: $filterNames) {
id
name
value
}
}
}
}
}
`,
{ appId, filterNames },
{ additionalTypenames: ['EnvironmentVariableWithSecret'] }
)
.toPromise()
);
return data.app?.byId.ownerAccount.environmentVariablesIncludingSensitive ?? [];
},
}; };
@@ -1,5 +1,5 @@
import { ExpoConfig } from '@expo/config'; import { ExpoConfig } from '@expo/config';
import { Env, Platform, Workflow } from '@expo/eas-build-job'; import { Platform, Workflow } from '@expo/eas-build-job';
import { BuildProfile } from '@expo/eas-json'; import { BuildProfile } from '@expo/eas-json';
import { import {
@@ -26,7 +26,6 @@ export async function getApplicationIdentifierAsync({
platform, platform,
vcsClient, vcsClient,
nonInteractive, nonInteractive,
env,
}: { }: {
graphqlClient: ExpoGraphqlClient; graphqlClient: ExpoGraphqlClient;
projectDir: string; projectDir: string;
@@ -36,7 +35,6 @@ export async function getApplicationIdentifierAsync({
platform: Platform; platform: Platform;
vcsClient: Client; vcsClient: Client;
nonInteractive: boolean; nonInteractive: boolean;
env: Env;
}): Promise<string> { }): Promise<string> {
if (platform === Platform.ANDROID) { if (platform === Platform.ANDROID) {
const profile = buildProfile as BuildProfile<Platform.ANDROID>; const profile = buildProfile as BuildProfile<Platform.ANDROID>;
@@ -73,12 +71,11 @@ export async function getApplicationIdentifierAsync({
{ exp, projectDir, nonInteractive: false, vcsClient }, { exp, projectDir, nonInteractive: false, vcsClient },
profile profile
); );
const targets = await resolveTargetsAsync({ const targets = await resolveTargetsAsync({
projectDir, projectDir,
exp, exp,
xcodeBuildContext, xcodeBuildContext,
env, env: profile.env,
vcsClient, vcsClient,
}); });
const applicationTarget = findApplicationTarget(targets); const applicationTarget = findApplicationTarget(targets);