Skip to content

feat: pass invocation_mode property to uploadDeployFunction endpoint #454

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

Merged
merged 4 commits into from
May 10, 2023

Conversation

eduardoboucas
Copy link
Member

@eduardoboucas eduardoboucas commented May 9, 2023

Pass invocation_mode to the uploadDeployFunction endpoint as a URL query parameter.

@eduardoboucas eduardoboucas requested a review from a team as a code owner May 9, 2023 14:51
@netlify
Copy link

netlify bot commented May 9, 2023

Deploy Preview for open-api ready!

Name Link
🔨 Latest commit 3fab5e4
🔍 Latest deploy log https://app.netlify.com/sites/open-api/deploys/645ba1922619380007ddcc0f
😎 Deploy Preview https://deploy-preview-454--open-api.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

paulo
paulo previously approved these changes May 9, 2023
@eduardoboucas
Copy link
Member Author

Sorry, I realised I was still missing the piece for passing the field to the deploy API call. Done in 72453ba.

@eduardoboucas eduardoboucas requested a review from paulo May 9, 2023 15:15
@@ -781,10 +781,11 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
})
}

if function.DisplayName != "" || function.Generator != "" {
if function.DisplayName != "" || function.Generator != "" || function.InvocationMode != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, is this condition correct? Can you have a function config without display name or generator, just the invocation mode?

Copy link
Member Author

Choose a reason for hiding this comment

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

You can. None of the fields are mandatory. I think the check is just preventing us from writing an empty function config object, which in itself feels weird but I didn't want to change it as part of this PR.

paulo
paulo previously approved these changes May 9, 2023
@eduardoboucas
Copy link
Member Author

Okay, slight change of plans! In db268d4 I've moved the new invocation_mode property out of https://open-api.netlify.com/#tag/deploy/operation/createSiteDeploy and into https://open-api.netlify.com/#tag/function/operation/uploadDeployFunction. This lets us store this information against the function and instead of the deploy, which makes more sense since the invocation mode is tied to the specific code of the function, not the deploy.


// Path OR Buffer should be populated
Path string
Buffer io.ReadSeeker
}

type FunctionMetadata struct {
Copy link
Member Author

Choose a reason for hiding this comment

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

I've added a struct because I can imagine us adding more function-specific properties in the future, and since FileBundle is shared with static files, it'd be a bit odd to pollute it with a bunch of function-specific properties.

In the future, it would make sense to also move Runtime to this struct, as it's also specific to functions.

@eduardoboucas eduardoboucas changed the title feat: add invocation_mode to functions config feat: pass invocation_mode property to uploadDeployFunction endpoint May 10, 2023
@@ -781,6 +793,7 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
})
}

// TODO: Move these to the `meta` object above.
Copy link
Contributor

Choose a reason for hiding this comment

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

assuming this is a todo in the future

Copy link
Member Author

@eduardoboucas eduardoboucas May 10, 2023

Choose a reason for hiding this comment

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

Yes, but actually it's not clear we definitely want to do this, so I've removed the comment in 3fab5e4.

return err
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this empty line is not needed, same as line 225

Copy link
Member Author

Choose a reason for hiding this comment

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

This code is automatically generated by Swagger, so it's not something we can control. 😢

Copy link
Contributor

Choose a reason for hiding this comment

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

ohh that makes sense 🤦

@eduardoboucas eduardoboucas merged commit 1a5ef29 into master May 10, 2023
@eduardoboucas eduardoboucas deleted the feat/invocation-mode branch May 10, 2023 15:32
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