Skip to main content

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:

  1. Pulls the zip artefact from your Artifact Registry (as the fractal-cloud-agent service account).
  2. Creates an agent-owned GCS source bucket if needed and uploads the zip.
  3. 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

import {GoogleFunction} from '@fractal_cloud/sdk';

const ordersFn = GoogleFunction.create({
id: 'orders-fn',
version: {major: 1, minor: 0, patch: 0},
displayName: 'Orders Function',
sourceArtifact:
'europe-west1-docker.pkg.dev/my-project/functions/orders-fn:1.4.0',
entryPoint: 'com.example.Orders',
runtime: 'java21',
location: 'europe-west1',
});

Satisfying a blueprint Function

import {Function, GoogleFunction} from '@fractal_cloud/sdk';

const fn = Function.create({
id: 'orders-fn',
version: {major: 1, minor: 0, patch: 0},
displayName: 'Orders Function',
sourceArtifact:
'europe-west1-docker.pkg.dev/my-project/functions/orders-fn:1.4.0',
entryPoint: 'com.example.Orders',
runtime: 'java21',
});

const cloudFn = GoogleFunction.satisfy(fn.component)
.withLocation('europe-west1')
.build();