Skip to content

GCP.CloudDeploy reference

Source: src/GCP/CloudDeploy/CustomTargetType.ts

A Cloud Deploy custom target type — a reusable render/deploy definition for deploying to systems besides the supported runtimes.

Changing customTargetTypeId or location replaces the type. Description, labels, annotations, customActions, and tasks update in place.

CustomTargetType: Creating a Custom Target Type

Section titled “CustomTargetType: Creating a Custom Target Type”

Skaffold custom actions

const type = yield* GCP.CloudDeploy.CustomTargetType("Helm", {
customActions: { deployAction: "helm-deploy" },
description: "helm custom target",
});

Container tasks

const type = yield* GCP.CloudDeploy.CustomTargetType("Helm", {
tasks: {
deploy: {
container: { image: "us-docker.pkg.dev/my-project/tools/deploy:latest" },
},
},
labels: { env: "prod" },
});

CustomTargetType: Updating a Custom Target Type

Section titled “CustomTargetType: Updating a Custom Target Type”

Re-declare the same logical id with changed props; the engine keeps the physical resource and updates it in place.

const type = yield* GCP.CloudDeploy.CustomTargetType("Helm", {
customActions: { deployAction: "helm-deploy" },
description: "helm custom target v2",
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/CloudDeploy/DeliveryPipeline.ts

A Cloud Deploy delivery pipeline — the ordered stages a Skaffold configuration progresses through.

Changing deliveryPipelineId or location replaces the pipeline. serialPipeline, description, labels, annotations, and suspended update in place.

DeliveryPipeline: Creating a Delivery Pipeline

Section titled “DeliveryPipeline: Creating a Delivery Pipeline”

Generated name

const pipeline = yield* GCP.CloudDeploy.DeliveryPipeline("App", {
serialPipeline: { stages: [{ targetId: "prod" }] },
});

Explicit id and labels

const pipeline = yield* GCP.CloudDeploy.DeliveryPipeline("App", {
deliveryPipelineId: "app-pipeline",
serialPipeline: {
stages: [
{ targetId: "staging" },
{ targetId: "prod" },
],
},
labels: { env: "prod" },
});

DeliveryPipeline: Updating a Delivery Pipeline

Section titled “DeliveryPipeline: Updating a Delivery Pipeline”

Re-declare the same logical id with changed props; the engine keeps the physical resource and updates it in place.

const pipeline = yield* GCP.CloudDeploy.DeliveryPipeline("App", {
serialPipeline: { stages: [{ targetId: "prod" }] },
description: "app pipeline v2",
suspended: true,
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/CloudDeploy/DeliveryPipelinesAutomation.ts

A Cloud Deploy automation attached to a delivery pipeline. Automations promote releases, repair failed rollouts, and advance rollout phases without a human in the loop.

Changing automationId, location, or deliveryPipeline replaces the automation. Rules, selector, service account, description, labels, annotations, and suspended update in place.

DeliveryPipelinesAutomation: Creating an Automation

Section titled “DeliveryPipelinesAutomation: Creating an Automation”

Promote to the next stage

const automation = yield* GCP.CloudDeploy.DeliveryPipelinesAutomation("Promote", {
deliveryPipeline: pipeline.name,
serviceAccount: "deployer@my-project.iam.gserviceaccount.com",
selector: { targets: [{ id: "*" }] },
rules: [{ promoteReleaseRule: { id: "promote-release" } }],
});

Timed promote

const automation = yield* GCP.CloudDeploy.DeliveryPipelinesAutomation("Nightly", {
deliveryPipeline: pipeline.name,
serviceAccount: "deployer@my-project.iam.gserviceaccount.com",
selector: { targets: [{ id: "staging" }] },
rules: [{
timedPromoteReleaseRule: {
id: "weekday-promote",
schedule: "0 9 * * 1-5",
timeZone: "America/New_York",
},
}],
labels: { env: "prod" },
});

DeliveryPipelinesAutomation: Updating an Automation

Section titled “DeliveryPipelinesAutomation: Updating an Automation”

Re-declare the same logical id with changed props; the engine keeps the physical resource and updates it in place.

const automation = yield* GCP.CloudDeploy.DeliveryPipelinesAutomation("Promote", {
deliveryPipeline: pipeline.name,
serviceAccount: "deployer@my-project.iam.gserviceaccount.com",
selector: { targets: [{ id: "*" }] },
rules: [{ promoteReleaseRule: { id: "promote-release" } }],
description: "promote v2",
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/CloudDeploy/DeployPolicy.ts

A Cloud Deploy policy that restricts rollout actions on selected delivery pipelines and targets (for example a weekend freeze).

Changing deployPolicyId or location replaces the policy. Selectors, rules, description, labels, annotations, and suspended update in place.

Weekend freeze

const policy = yield* GCP.CloudDeploy.DeployPolicy("Freeze", {
selectors: [{ target: { id: "*" } }],
rules: [{
rolloutRestriction: {
id: "weekends",
timeWindows: {
timeZone: "America/Los_Angeles",
weeklyWindows: [{ daysOfWeek: ["SATURDAY", "SUNDAY"] }],
},
},
}],
});

Business-hours only

const policy = yield* GCP.CloudDeploy.DeployPolicy("Freeze", {
selectors: [{ deliveryPipeline: { id: "prod" } }],
rules: [{
rolloutRestriction: {
id: "after-hours",
actions: ["CREATE", "APPROVE"],
timeWindows: {
timeZone: "America/New_York",
weeklyWindows: [{
daysOfWeek: ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY"],
startTime: { hours: 17 },
endTime: { hours: 24 },
}],
},
},
}],
labels: { env: "prod" },
});

Re-declare the same logical id with changed props; the engine keeps the physical resource and updates it in place.

const policy = yield* GCP.CloudDeploy.DeployPolicy("Freeze", {
selectors: [{ target: { id: "*" } }],
rules: [{
rolloutRestriction: {
id: "weekends",
timeWindows: {
timeZone: "America/Los_Angeles",
weeklyWindows: [{ daysOfWeek: ["SATURDAY", "SUNDAY"] }],
},
},
}],
description: "weekend freeze v2",
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/CloudDeploy/Target.ts

A Cloud Deploy target — a location a Skaffold configuration can be deployed to (GKE, Cloud Run, Anthos, a custom target type, or a multi-target).

Changing targetId or location replaces the target. Destination, approval, execution configs, description, labels, and annotations update in place.

Cloud Run

const target = yield* GCP.CloudDeploy.Target("Prod", {
run: { location: "projects/my-project/locations/us-central1" },
});

GKE cluster

const target = yield* GCP.CloudDeploy.Target("Prod", {
gke: {
cluster: "projects/my-project/locations/us-central1/clusters/app",
},
requireApproval: true,
labels: { env: "prod" },
});

Re-declare the same logical id with changed props; the engine keeps the physical resource and updates it in place.

const target = yield* GCP.CloudDeploy.Target("Prod", {
run: { location: "projects/my-project/locations/us-central1" },
description: "prod run target v2",
labels: { env: "prod", team: "platform" },
});