Skip to content

Commit

Permalink
Merge branch 'master' into hlshen/stream
Browse files Browse the repository at this point in the history
  • Loading branch information
hlshen authored Jan 22, 2025
2 parents 4e5906e + 341a6e0 commit ea68a53
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 46 deletions.
3 changes: 3 additions & 0 deletions src/deploy/functions/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export interface HttpsTriggered {

/** API agnostic version of a Firebase callable function. */
export type CallableTrigger = {
// NOTE: This is currently unused because GCF 2nd gen labels do not support
// the characterset that may be in a genkit action name.
// This should be set as a Cloud Run attribute once we move to Cloud Run Functions.
genkitAction?: string;
};

Expand Down
40 changes: 0 additions & 40 deletions src/gcp/cloudfunctionsv2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,23 +221,6 @@ describe("cloudfunctionsv2", () => {
[BLOCKING_LABEL]: "before-sign-in",
},
});

expect(
cloudfunctionsv2.functionFromEndpoint({
...ENDPOINT,
platform: "gcfv2",
callableTrigger: {
genkitAction: "flows/flow",
},
}),
).to.deep.equal({
...CLOUD_FUNCTION_V2,
labels: {
...CLOUD_FUNCTION_V2.labels,
"deployment-callable": "true",
"genkit-action": "flows/flow",
},
});
});

it("should copy trival fields", () => {
Expand Down Expand Up @@ -654,29 +637,6 @@ describe("cloudfunctionsv2", () => {
});
});

it("should translate genkit callables", () => {
expect(
cloudfunctionsv2.endpointFromFunction({
...HAVE_CLOUD_FUNCTION_V2,
labels: {
"deployment-callable": "true",
"genkit-action": "flows/flow",
},
}),
).to.deep.equal({
...ENDPOINT,
callableTrigger: {
genkitAction: "flows/flow",
},
platform: "gcfv2",
uri: GCF_URL,
labels: {
"deployment-callable": "true",
"genkit-action": "flows/flow",
},
});
});

it("should copy optional fields", () => {
const extraFields: backend.ServiceConfiguration = {
ingressSettings: "ALLOW_ALL",
Expand Down
6 changes: 0 additions & 6 deletions src/gcp/cloudfunctionsv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,6 @@ export function functionFromEndpoint(endpoint: backend.Endpoint): InputCloudFunc
gcfFunction.labels = { ...gcfFunction.labels, "deployment-taskqueue": "true" };
} else if (backend.isCallableTriggered(endpoint)) {
gcfFunction.labels = { ...gcfFunction.labels, "deployment-callable": "true" };
if (endpoint.callableTrigger.genkitAction) {
gcfFunction.labels["genkit-action"] = endpoint.callableTrigger.genkitAction;
}
} else if (backend.isBlockingTriggered(endpoint)) {
gcfFunction.labels = {
...gcfFunction.labels,
Expand Down Expand Up @@ -657,9 +654,6 @@ export function endpointFromFunction(gcfFunction: OutputCloudFunction): backend.
trigger = {
callableTrigger: {},
};
if (gcfFunction.labels["genkit-action"]) {
trigger.callableTrigger.genkitAction = gcfFunction.labels["genkit-action"];
}
} else if (gcfFunction.labels?.[BLOCKING_LABEL]) {
trigger = {
blockingTrigger: {
Expand Down

0 comments on commit ea68a53

Please sign in to comment.