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] [ENG-10225] add requiredPackageManager to build metadata #2067

Merged
merged 7 commits into from
Oct 3, 2023

Conversation

kadikraman
Copy link
Contributor

@kadikraman kadikraman commented Sep 27, 2023

Why

We want to know what the user's package manager is going to be at the "install custom tools" step of the build process, so we're determining it based on the user's lockfiles and adding it to build metadata.

  1. eas-build-job [eas-build-job] [ENG-10225] add requiredPackageManager to build metadata eas-build#281
  2. www https://github.com/expo/universe/pull/13522
  3. 👉 eas-cli [eas-cli] [ENG-10225] add requiredPackageManager to build metadata #2067
  4. turtle-v2 https://github.com/expo/turtle-v2/pull/1460

How

Added the field.

Test Plan

Unit tests and building locally.

@linear
Copy link

linear bot commented Sep 27, 2023

ENG-10225 Ignore custom tools installation errors when the tool is not the preferred packager

Context: https://exponent-internal.slack.com/archives/C02123T524U/p1695688801287029

Steps to reproduce:

  1. Use macos-ventura-13.4-xcode-14.3.1 and "node": "14.21.3" in your eas.json

    "build": {
      "base": {
        "ios": {
          "image": "macos-ventura-13.4-xcode-14.3.1"
        }
      },
      "development": {
        "node": "14.21.3"
      },
    }
    ...
    
  2. yarn install and ensure you have a yarn.lock in the codebase (no other lockfiles)

  3. build on EAS

  4. ✅ expected: "install custom tools" step shows a warning that installing pnpm failed, but the build does not error

  5. ❌ actual: "install custom tools" step errors and fails the build

There are two tasks to make this happen:

  1. add a new field to EAS metadata that records the preferred package manager (use the logic in expo/package-manager so it matches the tool actually used)

  2. use this field to determine when to fail the build in Turtle. Fail only when pnpm is actually needed:

    Case 1: ✅ pnpm-lock | ❌ pnpm | ❌ node → ⏩ skip installing pnpm

    Case 2: ✅ pnpm-lock | ✅ pnpm | ❌ node → 🛜 install pnpm + must succeed

    Case 3: ✅ pnpm-lock | ❌ pnpm | ✅ node → 🛜 install pnpm + must succeed

    Case 4: ✅ pnpm-lock | ✅ pnpm | ✅ node → 🛜 install pnpm + must succeed

    Case 5: ❌ pnpm-lock | ❌ pnpm | ❌ node → ⏩ skip installingpnpm

    Case 6: ❌ pnpm-lock | ✅ pnpm | ❌ node → 🛜 install pnpm + must succeed

    Case 7: ❌ pnpm-lock | ❌ pnpm | ✅ node → 💨 skip installing

@github-actions
Copy link

github-actions bot commented Sep 27, 2023

Size Change: +60.9 kB (0%)

Total Size: 42.6 MB

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

compressed-size-action

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Merging #2067 (e640155) into main (0fba735) will decrease coverage by 0.00%.
The diff coverage is 33.34%.

@@            Coverage Diff             @@
##             main    #2067      +/-   ##
==========================================
- Coverage   54.07%   54.06%   -0.00%     
==========================================
  Files         508      508              
  Lines       18638    18641       +3     
  Branches     3721     3722       +1     
==========================================
+ Hits        10076    10077       +1     
- Misses       8542     8544       +2     
  Partials       20       20              
Files Coverage Δ
packages/eas-cli/src/graphql/generated.ts 100.00% <ø> (ø)
packages/eas-cli/src/build/createContext.ts 22.96% <50.00%> (+0.92%) ⬆️
packages/eas-cli/src/build/metadata.ts 21.98% <0.00%> (-0.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.

It looks good, one comment:

Also one reminder: remember to update dependencies in turtle-v2 before deploying it

packages/eas-cli/src/build/metadata.ts Outdated Show resolved Hide resolved
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.

Nice 🚀 . Thanks!

@github-actions
Copy link

github-actions bot commented Oct 3, 2023

✅ Thank you for adding the changelog entry!

@kadikraman kadikraman merged commit feaedbe into main Oct 3, 2023
9 checks passed
@kadikraman kadikraman deleted the @kadikraman/package-manager-metadata branch October 3, 2023 10: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.

2 participants