Google Cloud Functions
This page shows how to deploy a Google Cloud Function (gen2) from an OCI artefact using the Fractal SDK.
For the artefact contract and prerequisites, see the main guide.
How the agent deploys
Cloud Functions gen2 build from a source zip (GCS or Cloud Source Repos), so the artefact must be a zip — a container-image artefact is rejected. The agent:
- Pulls the zip artefact from your Artifact Registry (as the
fractal-cloud-agentservice account). - Creates an agent-owned GCS source bucket if needed and uploads the zip.
- Deploys the function with that bucket/object as its
StorageSource.
The agent owns the source-bucket lifecycle; you only publish the artefact. entryPoint is required.
TypeScript SDK
A function is split across the two levels like every other component. The blueprint declares an
abstract Function and governs the vendor-neutral parameters; the Live System selects the
GcpFunction offer and supplies the GCP-specific ones.
1. Declare the Function in the blueprint
import {createFractal, Function} from '@fractal_cloud/sdk/model';
export const fractal = createFractal({
id: 'orders',
version: {major: 1, minor: 0, patch: 0},
description: 'Orders processing function.',
boundedContextId: {
ownerType: 'Personal',
ownerId: process.env['OWNER_ID']!,
name: 'reusable-templates',
},
blueprint: bp => {
const orders = bp.add(
Function({id: 'orders-fn', displayName: 'Orders Function'})
.withRuntime('java21') // guardrail
.withMemory(512) // guardrail: MB
.withTimeout(30) // guardrail: seconds
.withEnvironment({LOG_LEVEL: 'INFO'}),
);
return {orders};
},
operations: s => ({
/** The artefact the application ships. */
withArtifact: (uri: string) => s.orders.set('sourceArtifact', uri),
}),
});
withRuntime, withMemory, withTimeout, withConcurrency and withEnvironment are vendor-neutral
and identical on every cloud — the same blueprint satisfies an AWS Lambda or an Azure Function without
editing.
2. Select the Cloud Functions offer in the Live System
import {GcpFunction} from '@fractal_cloud/sdk/model';
const liveSystem = fractal
.specialize()
.withArtifact('europe-west1-docker.pkg.dev/my-project/functions/orders-fn:1.4.0')
.toLiveSystem({
name: 'orders-dev',
environment,
select: {
'orders-fn': GcpFunction({
region: 'europe-west1',
entryPoint: 'com.example.Orders',
}),
},
});
entryPoint is a GCP concept and is required by the offer, so it lives there rather than on the
component — a blueprint carrying it could never be satisfied by another vendor.
See the Component Reference for every parameter the offer accepts, and Core API for the authoring surface.