-
Notifications
You must be signed in to change notification settings - Fork 367
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
chore: support envelope in graph:init #4947
Conversation
📊 Benchmark resultsComparing with f6c3d78 Package size: 222 MB(no change)
Legend
|
let siteData = null | ||
try { | ||
// @ts-ignore: we need better types for our api object | ||
siteData = await api.getSite({ siteId }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted this block of code because everything we need should already be available in command.netlify.siteInfo
-- is this an incorrect assumption on my part?
netlifyGraphConfig, | ||
}) | ||
|
||
if (process.env.NODE_ENV !== 'test') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this conditional to skip over in integration testing
{ | ||
path: 'accounts/test-account/env', | ||
method: 'GET', | ||
response: [envelopeResponse[1]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the test, we set NETLIFY_GRAPH_PERSIST_QUERY_TOKEN
to already exist, in order to skip over some of the logic that reaches out using the OneGraph client. I didn't know how to mock that out, so skipped over it to at least test some of the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you wouldn't mind updating the persist query token scope, I can follow up with a quick approval.
Thanks for taking the time to port this over!
src/commands/graph/graph-init.js
Outdated
}, | ||
!env.NETLIFY_GRAPH_PERSIST_QUERY_TOKEN && { | ||
key: 'NETLIFY_GRAPH_PERSIST_QUERY_TOKEN', | ||
scopes: ['functions'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are scopes
typed? As in, will autocomplete ensure that I'm not putting in spurious scope values?
Also, this token needs to be available in build, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scopes are defined here in the openapi spec for this method -- should anything else be needed to populate autocomplete suggestions in the cli codebase?
Summary
Fixes https://github.com/netlify/pillar-workflow/issues/802 (continuation of #4711)
netlify graph:init
creates two new environment variables on the site. It currently saves those env vars attached to the site record in Mongo. However, env vars are moving to a separate service (called Envelope) that has its own API and that is detached from the site record. This PR adds logic to detect that if a site has opted into Envelope, to save the newly created env vars to the Envelope service.Envelope also supports scoped environment variables, which means you can set env vars to only be present in e.g. builds or only available in functions. I think the ones that Graph sets only need to be in the functions runtime, is that correct?
For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)