Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

feat: add new runtimeVersion to manifest #1367

Merged
merged 5 commits into from
Apr 11, 2023
Merged

feat: add new runtimeVersion to manifest #1367

merged 5 commits into from
Apr 11, 2023

Conversation

danez
Copy link
Contributor

@danez danez commented Mar 6, 2023

Summary

The option nodeVersion now works differently and allows different styles of how the Node.js version is specified.
If it cannot be coerced to a Node.js version, the undefined is added to the manifest, leaving the choice of runtime to origin. We could also change this to have zisi add the default to the manifest, but I didn't do it because I feel its nicer to have the default version only in one place.

How it is supposed to work is that @netlify/build sets nodeVersion to AWS_LAMBDA_JS_VERSION || buildUserNodeVersion and based on this input we set a new field runtimeVersion in the manifest, or not if it is not a valid runtime version.
open-api reads the manifest and sends runtimeVersion || runtime. In the origin we then detect if it is a runtime shortcut 'js' or a full runtime image name.

Ref: netlify/pod-compute#33
Ref: netlify/pod-compute#64

This would also allow the runtime being set by the deployment config API.

@danez danez requested a review from a team March 6, 2023 09:26
@danez danez self-assigned this Mar 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2023

⏱ Benchmark results

Comparing with f9e621b

largeDepsEsbuild: 2s

⬇️ 4.56% decrease vs. f9e621b

^                                                                            3s                           
│                                                                           ┌──┐                          
│                                                                           |  |                          
│                                                                           |  |                          
│                                           2.5s            2.5s            |  |                          
│                   2.2s                    ┌──┐    2.3s    ┌──┐    2.3s    |  |                          
│ ──2.2s────2.1s────┌──┐────2.1s────2.1s────┼──┼────┌──┐────┼──┼────┌──┐────┼──┼────────────2.1s──────────
│   ┌──┐    ┌──┐    |  |    ┌──┐    ┌──┐    |  |    |  |    |  |    |  |    |  |     2s     ┌──┐     2s   
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    |  |    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend

largeDepsNft: 7.6s

⬇️ 7.89% decrease vs. f9e621b

^                                                                          12.5s                          
│                                                                           ┌──┐                          
│                                                                           |  |                          
│                                                                           |  |                          
│                                                          10.1s            |  |                          
│                                           9.4s            ┌──┐            |  |                          
│                                           ┌──┐            |  |    8.6s    |  |                          
│ ──8.4s────────────8.2s────7.9s─────8s─────┼──┼────8.4s────┼──┼────┌──┐────┼──┼────────────8.2s──────────
│   ┌──┐    7.4s    ┌──┐    ┌──┐    ┌──┐    |  |    ┌──┐    |  |    |  |    |  |    7.6s    ┌──┐    7.6s  
│   |  |    ┌──┐    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    |  |    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend

largeDepsZisi: 15s

⬇️ 5.73% decrease vs. f9e621b

^                                                                          22.8s                          
│                                                                           ┌──┐                          
│                                                                           |  |                          
│                                                                           |  |                          
│                                          18.5s           18.7s            |  |                          
│                                           ┌──┐            ┌──┐            |  |                          
│ ─15.8s───────────15.7s───15.4s───15.5s────┼──┼───16.5s────┼──┼───16.3s────┼──┼───────────15.9s──────────
│   ┌──┐   14.9s    ┌──┐    ┌──┐    ┌──┐    |  |    ┌──┐    |  |    ┌──┐    |  |   14.7s    ┌──┐    15s   
│   |  |    ┌──┐    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    |  |    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend

@danez danez changed the title feat!: add nodeRuntime to manifest feat!: add runtimeID to manifest Mar 30, 2023
@danez danez requested a review from a team March 30, 2023 10:44
khendrikse
khendrikse previously approved these changes Mar 30, 2023
src/manifest.ts Show resolved Hide resolved
Copy link
Member

@eduardoboucas eduardoboucas left a comment

Choose a reason for hiding this comment

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

Can you add a note outlining the breaking changes?

README.md Outdated Show resolved Hide resolved
src/manifest.ts Show resolved Hide resolved
src/manifest.ts Outdated
mainFile,
name,
path,
runtime,
runtimeID,
Copy link
Member

Choose a reason for hiding this comment

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

I find it a bit confusing to have runtime and runtimeID here. My understanding is that the former comes from the input and the latter is a coerced version of that? Do we need them both here? If so, can we do anything to make the distinction a bit clearer?

Copy link
Contributor Author

@danez danez Mar 31, 2023

Choose a reason for hiding this comment

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

Yes this was also annoying me.
runtime is js, rs, go
Where runtimeID now is the actual runtimenodejs18.x

Imho, runtime should probably called language, but I didn't want to change an existing field. Other solution would be instead of runtimeID add a field called nodeVersion where we simply add the node version that zisi received and use it in bitballoon/FO to decide on the runtime. Although that would not allow the deployment config API to set a runtime, but maybe if they set a node-version would be okay? What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am waiting on this for reviewing the rest of the PRs, as this field it's going to be change it makes the other PRs obsolete or in needs of a change. My two cents: I need to always check in code what these 2 are.

language and runtimeID seems good for me, as it kind of match the description for AWS lambda runtimes.

By this comment, looks like we are going to make a PR in every repository touching runtimes, so maybe the effort of renaming them is not that big?

Copy link
Contributor Author

@danez danez Apr 4, 2023

Choose a reason for hiding this comment

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

I went for using one field for either language or the runtime name. Zisi writes both (runtime and runtimeName) to the manifest, because I'm not sure where runtime might be used outside of buildbot/open-api.
open-api then reads both from the manifest and sends runtimeName || runtime to the API call.

@danez danez changed the title feat!: add runtimeID to manifest feat: add new runtimeName to manifest Apr 3, 2023
@danez
Copy link
Contributor Author

danez commented Apr 4, 2023

Can you add a note outlining the breaking changes?

No breaking changes anymore. the nodeVersion field now supports a wider range of values, but still supports what was supported before.

vitest.config.ts Show resolved Hide resolved
eduardoboucas
eduardoboucas previously approved these changes Apr 5, 2023
README.md Outdated Show resolved Hide resolved
src/runtimes/runtime.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@khendrikse khendrikse left a comment

Choose a reason for hiding this comment

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

I'm not seeing specifically weird stuff, and would approve, but I see Eduardo is also looking at this, and I think his review could be more valuable right now ❤️

@danez danez requested a review from eduardoboucas April 6, 2023 10:47
src/manifest.ts Outdated Show resolved Hide resolved
@danez danez changed the title feat: add new runtimeName to manifest feat: add new runtimeVersion to manifest Apr 11, 2023
@danez danez requested a review from eduardoboucas April 11, 2023 09:34
@danez danez enabled auto-merge (squash) April 11, 2023 13:22
@danez danez merged commit b5286b3 into main Apr 11, 2023
@danez danez deleted the node-runtime branch April 11, 2023 13:26
Skn0tt pushed a commit to netlify/build that referenced this pull request May 21, 2024
…1367)

* feat: add new runtimeName to manifest

* chore: increase test timeout

* chore: fix docs

* chore: rename field
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants