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

Add ingress settings support in firebase functions #2924

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master' into add-ingress-setti…
…ngs-support-in-firebase-functions
  • Loading branch information
takaaa220 committed Dec 27, 2020
commit f97c40c6f064e7274220aa874912ca314e3477ec
104 changes: 39 additions & 65 deletions src/deploy/functions/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,71 +298,45 @@ module.exports = function(context, options, payload) {
var existingFunction = _.find(existingFunctions, {
name: name,
});
var existingEventType = _.get(existingFunction, "eventTrigger.eventType");
var migratingTrigger = false;
if (
eventType.match(/google.storage.object./) &&
existingEventType === "providers/cloud.storage/eventTypes/object.change"
) {
migratingTrigger = true;
} else if (
eventType === "google.pubsub.topic.publish" &&
existingEventType === "providers/cloud.pubsub/eventTypes/topic.publish"
) {
migratingTrigger = true;
}
if (migratingTrigger) {
throw new FirebaseError(
"Function " +
clc.bold(functionName) +
" was deployed using a legacy trigger type and cannot be updated without deleting " +
"the previous function. Follow the instructions on " +
clc.underline(
"https://firebase.google.com/docs/functions/manage-functions#modify-trigger"
) +
" for how to change the trigger without losing events.\n"
);
} else {
var options = {
projectId: projectId,
region: region,
functionName: functionName,
trigger: functionTrigger,
sourceUploadUrl: sourceUrl,
labels: _.assign({}, deploymentTool.labels, functionInfo.labels),
availableMemoryMb: functionInfo.availableMemoryMb,
timeout: functionInfo.timeout,
runtime: runtime,
maxInstances: functionInfo.maxInstances,
vpcConnector: functionInfo.vpcConnector,
vpcConnectorEgressSettings: functionInfo.vpcConnectorEgressSettings,
serviceAccountEmail: functionInfo.serviceAccountEmail,
ingressSettings: functionInfo.ingressSettings,
environmentVariables: _.assign(
{},
existingFunction.environmentVariables,
defaultEnvVariables
),
};
utils.logBullet(
clc.bold.cyan("functions: ") +
"updating " +
friendlyRuntimeName(runtime) +
" function " +
clc.bold(helper.getFunctionLabel(name)) +
"..."
);
logger.debug("Trigger is: ", JSON.stringify(functionTrigger));
_startTimer(name, "update");

deployments.push({
name: name,
retryFunction: function() {
return gcp.cloudfunctions.update(options);
},
trigger: functionTrigger,
});
}
var options = {
projectId: projectId,
region: region,
functionName: functionName,
trigger: functionTrigger,
sourceUploadUrl: sourceUrl,
labels: _.assign({}, deploymentTool.labels, functionInfo.labels),
availableMemoryMb: functionInfo.availableMemoryMb,
timeout: functionInfo.timeout,
runtime: runtime,
maxInstances: functionInfo.maxInstances,
vpcConnector: functionInfo.vpcConnector,
vpcConnectorEgressSettings: functionInfo.vpcConnectorEgressSettings,
serviceAccountEmail: functionInfo.serviceAccountEmail,
ingressSettings: functionInfo.ingressSettings,
environmentVariables: _.assign(
{},
existingFunction.environmentVariables,
defaultEnvVariables
),
};
utils.logBullet(
clc.bold.cyan("functions: ") +
"updating " +
friendlyRuntimeName(runtime) +
" function " +
clc.bold(helper.getFunctionLabel(name)) +
"..."
);
logger.debug("Trigger is: ", JSON.stringify(functionTrigger));
_startTimer(name, "update");

deployments.push({
name: name,
retryFunction: function() {
return gcp.cloudfunctions.update(options);
},
trigger: functionTrigger,
});
})
.value();

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.