-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move environment from metadata to job object (#2777)
<!-- If this PR requires a changelog entry, add it by commenting the PR with the command `/changelog-entry [breaking-change|new-feature|bug-fix|chore] [message]`. --> <!-- You can skip the changelog check by labeling the PR with "no changelog". --> # Why [ENG-14307: move environment to job object from metadata](https://linear.app/expo/issue/ENG-14307/move-environment-to-job-object-from-metadata) `Environment` should be considering a first class citizen in job object instead of being stored in the metadata. # How * Pass `environment` in `job` object * remove `environment` from `metadata`. # Test Plan 1. Start a build specifying `environment` in `eas.json`. 2. Build should use the specified environment (check on website in `Build details`)
- Loading branch information
1 parent
a20bd00
commit 3159550
Showing
7 changed files
with
33 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { BuildProfile } from '@expo/eas-json'; | ||
|
||
import { EnvironmentVariableEnvironment } from '../../graphql/generated'; | ||
|
||
type Environment = NonNullable<BuildProfile['environment']>; | ||
|
||
const BuildProfileEnvironmentToEnvironment: Record<Environment, EnvironmentVariableEnvironment> = { | ||
production: EnvironmentVariableEnvironment.Production, | ||
preview: EnvironmentVariableEnvironment.Preview, | ||
development: EnvironmentVariableEnvironment.Development, | ||
}; | ||
|
||
export function isEnvironment(env: string): env is EnvironmentVariableEnvironment { | ||
return Object.values(EnvironmentVariableEnvironment).includes( | ||
env as EnvironmentVariableEnvironment | ||
); | ||
} | ||
|
||
export function buildProfileEnvironmentToEnvironment( | ||
environment: BuildProfile['environment'] | ||
): EnvironmentVariableEnvironment | null { | ||
if (!environment) { | ||
return null; | ||
} | ||
return BuildProfileEnvironmentToEnvironment[environment]; | ||
} |