Skip to content

Add new option to preserveExternalChanges. #1253

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 15 commits into from
Oct 5, 2022
Merged

Conversation

taeold
Copy link
Contributor

@taeold taeold commented Oct 4, 2022

This PR make some sweeping changes!

  1. We change the default behavior of the SDK so that any un-annotated configuration option that is resettable are given RESET_VALUE. Practically, this means that given a function configuration like this:
export const v2Req = onRequest(
  (req, res) => {
    res.sendStatus(200)
  },
);

And you go ahead and change the memory configuration of the function using GCP Console or gcloud tool, we will revert the memory back to platform default on the next function deploy.

  1. You may optionally opt-out of this behavior by setting preserveExternalChanges option:
exports.v1httpPreserve = functions
  .runWith({ preserveExternalChanges: true })
  .https.onRequest((req, resp) => {
    resp.status(200).send("PASS");
  });

functionsv2.setGlobalOptions({ preserveExternalChanges: true });

exports.v2http = functionsv2.https.onRequest((req, resp) => {
  resp.status(200).send("PASS");
});

This change broke a lot of test. I broke up the change for fixing test cases in a separate PR #1254.

@taeold
Copy link
Contributor Author

taeold commented Oct 4, 2022

@taeold taeold mentioned this pull request Oct 4, 2022
@taeold taeold force-pushed the dl-preserve-cfg branch 4 times, most recently from 6ebb3e4 to 979f186 Compare October 5, 2022 16:16
@taeold taeold marked this pull request as ready for review October 5, 2022 16:25
Copy link
Contributor

@colerogers colerogers left a comment

Choose a reason for hiding this comment

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

Since spec/v1/providers/fixtures.ts is empty, can we remove it?

@@ -0,0 +1,13 @@
import { ManifestEndpoint } from "../src/runtime/manifest";
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing copyright notice, maybe we can have the linter add things like this?

* @internal
*/
export type ResettableKeys<T> = Required<{
[K in keyof T as [ResetValue] extends [T[K]] ? K : never]: null;
Copy link
Contributor

Choose a reason for hiding this comment

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

😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gotta love ts.

connector: string | Expression<string>;
egressSettings?: string | Expression<string> | ResetValue;
}
| ResetValue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the reset of the whole vpc setting, just removing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reset of the whole thing.

@taeold
Copy link
Contributor Author

taeold commented Oct 5, 2022

@colerogers It's used in the subsequent PR. Bad PR split!

@taeold taeold changed the base branch from dl-reset-values to launch.next October 5, 2022 20:11
Fix all test cases that were broken by #1253.
@taeold taeold merged commit 5f924bc into launch.next Oct 5, 2022
@taeold taeold deleted the dl-preserve-cfg branch October 5, 2022 20:21
@taeold taeold added this to the v4 milestone Oct 6, 2022
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