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

[ENG-10464][eas-cli] throw error if custom build config is gitignored #2123

Merged

Conversation

szdziedzic
Copy link
Member

Why

If you create a custom build with git ignored config file build on a server will fail even though local validation passed.

How

Use the VCS client to check if the file is ignored. Throw an error if it is.

Test Plan

Test locally. Git ignore the config. Make sure the build runs fine without git ignored config.

Screenshot 2023-11-16 at 17 07 44

@szdziedzic
Copy link
Member Author

changelog-entry chore Throw error if custom build config is gitignored

Copy link

github-actions bot commented Nov 16, 2023

Size Change: -1.09 kB (0%)

Total Size: 42.3 MB

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

compressed-size-action

@szdziedzic szdziedzic changed the title [eas-cli] throw error if custom build config is gitignored [ENG-10464][eas-cli] throw error if custom build config is gitignored Nov 16, 2023
Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (5b46476) 54.19% compared to head (00a73ec) 54.18%.

Files Patch % Lines
packages/eas-cli/src/project/customBuildConfig.ts 25.00% 3 Missing ⚠️
packages/eas-cli/src/build/runBuildAndSubmit.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2123      +/-   ##
==========================================
- Coverage   54.19%   54.18%   -0.00%     
==========================================
  Files         509      509              
  Lines       18660    18662       +2     
  Branches     3741     3742       +1     
==========================================
  Hits        10110    10110              
- Misses       8529     8531       +2     
  Partials       21       21              

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

@szdziedzic
Copy link
Member Author

/changelog-entry chore Throw error if custom build config is gitignored

Comment on lines +146 to +150
const maybeMetadata = await validateCustomBuildConfigAsync({
projectDir,
profile: buildProfile.profile,
vcsClient,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@@ -24,6 +31,13 @@ export async function validateCustomBuildConfigAsync(
`Custom build configuration file ${chalk.bold(relativeConfigPath)} does not exist.`
);
}
if (await vcsClient.isFileIgnoredAsync(relativeConfigPath)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

May a config file reference other files? Maybe not now, but in the future? Or TypeScript functions? Should we make sure whole .eas is committed instead (instead of just the config file)?

Copy link
Member Author

Choose a reason for hiding this comment

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

May a config file reference other files?

https://docs.expo.dev/custom-builds/schema/#import

Or TypeScript functions?

https://docs.expo.dev/custom-builds/schema/#functionsfunction_namepath

Should we make sure whole .eas is committed instead (instead of just the config file)?

Good question 🤔

I believe that we should fail if the currently used config file is git ignored, but maybe display a warning if other files in .eas are git ignored? Ideally, I feel like we can try to resolve which custom functions will be needed for a given build and which config files will be needed and validate that they are not git ignored, but I think it will require some more changes, and I think that we can merge it as v1 to make it better and not wait with it for other stuff to come along. WDYT?

Copy link
Member

@brentvatne brentvatne left a comment

Choose a reason for hiding this comment

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

s/custom build/job for future proofing, but otherwise looks good

@szdziedzic szdziedzic force-pushed the @szdziedzic/throw-error-if-custom-build-config-is-gitignored branch from 9d77517 to b5e4072 Compare November 22, 2023 17:21
@szdziedzic
Copy link
Member Author

/changelog-entry chore Throw error if custom build config is gitignored

Copy link

✅ Thank you for adding the changelog entry!

@szdziedzic szdziedzic merged commit 8c8b354 into main Nov 22, 2023
9 checks passed
@szdziedzic szdziedzic deleted the @szdziedzic/throw-error-if-custom-build-config-is-gitignored branch November 22, 2023 17:28
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.

3 participants