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

[eas-cli] Skip makeShallowCopyAsync if requireCommit #2885

Merged
merged 3 commits into from
Feb 6, 2025

Conversation

sjchmiela
Copy link
Contributor

@sjchmiela sjchmiela commented Feb 5, 2025

Why

requireCommit: true setups expect worktree to be clean (e.g. encrypted files to be locked).

How

Made it so if requireCommit is true we don't copy files over.

Test Plan

I have enabled git-crypt in my test repository, added a secret file, ran easd build:inspect -p android -s archive -o ~/test-production --force. The clone did contain secret file in plaintext.

Then I enabled requireCommit: true and repeated the command. The clone did contain the file encrypted.

Copy link

github-actions bot commented Feb 5, 2025

Size Change: +1.25 kB (0%)

Total Size: 53.4 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 53.4 MB +1.25 kB (0%)

compressed-size-action

Copy link

codecov bot commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.62%. Comparing base (b3d0924) to head (1907f8d).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2885      +/-   ##
==========================================
+ Coverage   52.41%   52.62%   +0.21%     
==========================================
  Files         588      588              
  Lines       23169    23170       +1     
  Branches     4851     4852       +1     
==========================================
+ Hits        12142    12190      +48     
+ Misses      10053    10014      -39     
+ Partials      974      966       -8     

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

@sjchmiela sjchmiela marked this pull request as ready for review February 5, 2025 21:35
@sjchmiela sjchmiela requested a review from szdziedzic February 5, 2025 21:35
Copy link

github-actions bot commented Feb 5, 2025

Subscribed to pull request

File Patterns Mentions
**/* @szdziedzic, @khamilowicz, @radoslawkrzemien

Generated by CodeMention

//
// We only do this if `requireCommit` is false because `requireCommit: true`
// setups expect no changes in files (e.g. locked files should remain locked).
await makeShallowCopyAsync(rootPath, destinationPath);
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if I understand. Why should we not do git clone when requireCommit: true is present?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It comes down to secrets and locked / unlocked repository (if using git-crypt).

Looks like requireCommit flag wasn't being used just as a "it's a good practice to always commit your changes", but more like "make tarball look exactly like a cloned repository at this commit would". In the former understanding it's not a big deal if we copy unlocked files to the tarball because the user did make a commit. In the latter understanding requireCommit is more like makeTarballResembleClone or something.

See discussion in here and how it broke Brent's setup with encrypted files (he was using requireCommit: true and was expecting encrypted files to be locked and worktree clean).

@sjchmiela sjchmiela requested a review from szdziedzic February 6, 2025 09:45
@sjchmiela sjchmiela merged commit b306109 into main Feb 6, 2025
6 checks passed
Copy link

github-actions bot commented Feb 6, 2025

✅ Thank you for adding the changelog entry!

@sjchmiela sjchmiela deleted the stanley/do-not-copy-over-if-require-commit branch February 6, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants