Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/gcp/runv2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@
httpsTrigger: {},
environmentVariables: { FOO: "bar" },
};
const expectedServiceInput = JSON.parse(

Check warning on line 101 in src/gcp/runv2.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
JSON.stringify({
...BASE_RUN_SERVICE,
name: `projects/${PROJECT_ID}/locations/${LOCATION}/services/${FUNCTION_ID.toLowerCase()}`,
}),
);
expectedServiceInput.template.containers[0].env.unshift({ name: "FOO", value: "bar" });

Check warning on line 107 in src/gcp/runv2.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe call of an `any` typed value

Check warning on line 107 in src/gcp/runv2.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .template on an `any` value

expect(runv2.serviceFromEndpoint(endpoint, IMAGE_URI)).to.deep.equal(expectedServiceInput);
});
Expand All @@ -117,13 +117,13 @@
{ key: "MY_SECRET", secret: "secret-name", projectId: PROJECT_ID, version: "1" },
],
};
const expectedServiceInput = JSON.parse(

Check warning on line 120 in src/gcp/runv2.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
JSON.stringify({
...BASE_RUN_SERVICE,
name: `projects/${PROJECT_ID}/locations/${LOCATION}/services/${FUNCTION_ID.toLowerCase()}`,
}),
);
expectedServiceInput.template.containers[0].env.unshift({

Check warning on line 126 in src/gcp/runv2.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe call of an `any` typed value

Check warning on line 126 in src/gcp/runv2.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .template on an `any` value
name: "MY_SECRET",
valueSource: { secretKeyRef: { secret: "secret-name", version: "1" } },
});
Expand All @@ -137,13 +137,13 @@
minInstances: 1,
maxInstances: 10,
};
const expectedServiceInput = JSON.parse(

Check warning on line 140 in src/gcp/runv2.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
JSON.stringify({
...BASE_RUN_SERVICE,
name: `projects/${PROJECT_ID}/locations/${LOCATION}/services/${FUNCTION_ID.toLowerCase()}`,
}),
);
expectedServiceInput.scaling = {

Check warning on line 146 in src/gcp/runv2.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .scaling on an `any` value
minInstanceCount: 1,
maxInstanceCount: 10,
};
Expand All @@ -157,13 +157,13 @@
httpsTrigger: {},
concurrency: 50,
};
const expectedServiceInput = JSON.parse(

Check warning on line 160 in src/gcp/runv2.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
JSON.stringify({
...BASE_RUN_SERVICE,
name: `projects/${PROJECT_ID}/locations/${LOCATION}/services/${FUNCTION_ID.toLowerCase()}`,
}),
);
expectedServiceInput.template.maxInstanceRequestConcurrency = 50;

Check warning on line 166 in src/gcp/runv2.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .template on an `any` value

expect(runv2.serviceFromEndpoint(endpoint, IMAGE_URI)).to.deep.equal(expectedServiceInput);
});
Expand Down Expand Up @@ -451,7 +451,7 @@
entryPoint: SERVICE_ID, // No FUNCTION_TARGET_ANNOTATION
availableMemoryMb: 128,
cpu: 0.5,
eventTrigger: { eventType: "unknown", retry: false },
httpsTrigger: {},
labels: {},
environmentVariables: {},
secretEnvironmentVariables: [],
Expand Down
5 changes: 3 additions & 2 deletions src/gcp/runv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export async function updateService(service: Omit<Service, ServiceOutputFields>)
);
// Always update revision name to ensure null generates a new unique revision name.
fieldMask.push("template.revision");
const res = await client.post<Omit<Service, ServiceOutputFields>, LongRunningOperation<Service>>(
const res = await client.patch<Omit<Service, ServiceOutputFields>, LongRunningOperation<Service>>(
service.name,
service,
{
Expand Down Expand Up @@ -619,7 +619,8 @@ export function endpointFromService(service: Omit<Service, ServiceOutputFields>)
? "ALLOW_INTERNAL_AND_GCLB"
: "ALLOW_ALL") as backend.IngressSettings,
// TODO: Figure out how to encode all trigger types to the underlying Run service that is compatible with both V2 functions and "direct to run" functions
...(service.annotations?.[TRIGGER_TYPE_ANNOTATION] === "HTTP_TRIGGER"
...(!service.annotations?.[TRIGGER_TYPE_ANNOTATION] ||
service.annotations?.[TRIGGER_TYPE_ANNOTATION] === "HTTP_TRIGGER"
? { httpsTrigger: {} }
: {
eventTrigger: {
Expand Down
Loading