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

Add eas env:push and env:pull commands #2495

Merged
merged 11 commits into from
Aug 26, 2024

Conversation

khamilowicz
Copy link
Contributor

@khamilowicz khamilowicz commented Aug 15, 2024

(Reopened #2437)

Why

User should be able to synchronise local environment variables with upstream.

How

  • added eas env:pull and eas env:push commands
  • eas env:pull handles sudo access to request values of sensitive variables

Test Plan

Tested manually

Copy link

linear bot commented Aug 15, 2024

@khamilowicz khamilowicz force-pushed the piotrekszeremeta/eng-11920-add-eas-envpush-command branch from 11d0062 to 14c0704 Compare August 15, 2024 08:41
Copy link

github-actions bot commented Aug 15, 2024

Size Change: +7.6 kB (+0.01%)

Total Size: 51.6 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 51.6 MB +7.6 kB (+0.01%)

compressed-size-action

@khamilowicz khamilowicz force-pushed the piotrekszeremeta/eng-11920-add-eas-envpush-command branch from 14c0704 to 3633d6e Compare August 15, 2024 08:45
@khamilowicz khamilowicz marked this pull request as ready for review August 15, 2024 08:45
@khamilowicz khamilowicz added the no changelog PR that doesn't require a changelog entry label Aug 15, 2024
Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 26.76056% with 156 lines in your changes missing coverage. Please review.

Project coverage is 52.59%. Comparing base (1540b13) to head (546e27b).
Report is 1 commits behind head on main.

Files Patch % Lines
packages/eas-cli/src/commands/env/push.ts 16.67% 68 Missing and 7 partials ⚠️
...as-cli/src/build/evaluateConfigWithEnvVarsAsync.ts 31.04% 20 Missing ⚠️
packages/eas-cli/src/commands/env/pull.ts 39.40% 17 Missing and 3 partials ⚠️
packages/eas-cli/src/commands/env/list.ts 18.19% 8 Missing and 1 partial ⚠️
...i/src/graphql/queries/EnvironmentVariablesQuery.ts 0.00% 6 Missing ⚠️
packages/eas-cli/src/commands/env/get.ts 0.00% 3 Missing and 1 partial ⚠️
packages/eas-cli/src/build/runBuildAndSubmit.ts 25.00% 3 Missing ⚠️
...c/graphql/mutations/EnvironmentVariableMutation.ts 0.00% 3 Missing ⚠️
packages/eas-cli/src/commands/config.ts 50.00% 2 Missing ⚠️
packages/eas-cli/src/commands/env/create.ts 0.00% 2 Missing ⚠️
... and 10 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2495      +/-   ##
==========================================
- Coverage   52.80%   52.59%   -0.20%     
==========================================
  Files         545      548       +3     
  Lines       20223    20406     +183     
  Branches     4130     4163      +33     
==========================================
+ Hits        10676    10731      +55     
- Misses       8719     8835     +116     
- Partials      828      840      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@khamilowicz khamilowicz force-pushed the piotrekszeremeta/eng-11920-add-eas-envpush-command branch from 8f7a376 to 3ccc56f Compare August 20, 2024 07:47
Copy link
Member

@szdziedzic szdziedzic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The push/pull stuff generally looks good to me, I would remove all sudo utils as they are not needed anymore + move init ,load and unload to separate PR to not block merging the push and pull stuff

packages/eas-cli/src/authUtils.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/build/runBuildAndSubmit.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/build/runBuildAndSubmit.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/build/runBuildAndSubmit.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/build/runBuildAndSubmit.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/commands/env/init.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/commands/env/load.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/commands/env/load.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/commands/env/pull.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/commands/env/unload.ts Outdated Show resolved Hide resolved
@khamilowicz khamilowicz force-pushed the piotrekszeremeta/eng-11920-add-eas-envpush-command branch from 3ccc56f to 9d7a177 Compare August 20, 2024 11:24
Copy link
Member

@szdziedzic szdziedzic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, good job we are making really good progress here 🚀

packages/eas-cli/src/build/runBuildAndSubmit.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/build/runBuildAndSubmit.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/build/runBuildAndSubmit.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/build/runBuildAndSubmit.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/build/local.ts Show resolved Hide resolved
packages/eas-cli/src/commands/env/get.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/commands/env/get.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/user/SessionManager.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/user/fetchSessionSecretAndUser.ts Outdated Show resolved Hide resolved
@khamilowicz khamilowicz force-pushed the piotrekszeremeta/eng-11920-add-eas-envpush-command branch from b9570a9 to be58276 Compare August 20, 2024 14:53
Copy link
Member

@szdziedzic szdziedzic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this new env will need to be passed/used everywhere where buildProfile.env is used:

env: ctx.buildProfile.env,


if (ctx.buildProfile.env?.NODE_ENV === 'production') {
Log.warn(
'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();
}

env: ctx.buildProfile.env,

env: buildProfile.env,

env: ctx.buildProfile.env,

const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({ env: buildProfile.env });






const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({ env: profile.env });

const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({
env: profileInfo.profile.env,
});


Copy link
Member

@szdziedzic szdziedzic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One general thing - I recommend using the Graphite tool to create stacked PRs (see how Will did it yesterday: https://app.graphite.dev/github/pr/expo/eas-cli/2505/chore-Add-typescript-linting-to-packages) vs putting 2-3 separate things:

  1. pull
  2. push
  3. using env vars
    in one big PR.

This way we can iterate faster vs being blocked with a review process because 1 out of 3 things in big PR is not right yet.

We don't need to do this in this PR though, this is advice for the future.

@khamilowicz khamilowicz force-pushed the piotrekszeremeta/eng-11920-add-eas-envpush-command branch from be58276 to e021f93 Compare August 21, 2024 16:29
packages/eas-cli/src/commands/config.ts Show resolved Hide resolved
packages/eas-cli/src/commands/env/pull.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/user/SessionManager.ts Outdated Show resolved Hide resolved
@khamilowicz khamilowicz force-pushed the piotrekszeremeta/eng-11920-add-eas-envpush-command branch from a229442 to e17b83a Compare August 22, 2024 15:00
Copy link
Member

@szdziedzic szdziedzic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, good job 👏

@khamilowicz khamilowicz force-pushed the piotrekszeremeta/eng-11920-add-eas-envpush-command branch from e17b83a to ed27075 Compare August 26, 2024 09:32
@khamilowicz khamilowicz force-pushed the piotrekszeremeta/eng-11920-add-eas-envpush-command branch from ed27075 to 546e27b Compare August 26, 2024 09:39
Copy link

⏩ The changelog entry check has been skipped since the "no changelog" label is present.

@khamilowicz khamilowicz merged commit 56510f0 into main Aug 26, 2024
9 checks passed
@khamilowicz khamilowicz deleted the piotrekszeremeta/eng-11920-add-eas-envpush-command branch August 26, 2024 09:46
khamilowicz added a commit that referenced this pull request Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog PR that doesn't require a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants