DocsSchema ReferenceCodefresh Service

Codefresh Service

Trigger external Codefresh pipelines for deployment and destruction

The codefresh service type delegates deployment to external Codefresh pipelines. This is useful when you have existing CI/CD pipelines that handle complex build and deployment logic.

Example

Required Fields

FieldTypeDescription
repositorystringGitHub repository in owner/repo format
branchNamestringBranch to build from
deploy.pipelineIdstringCodefresh pipeline ID for deployment
deploy.triggerstringPipeline trigger name for deployment
destroy.pipelineIdstringCodefresh pipeline ID for destruction
destroy.triggerstringPipeline trigger name for destruction

Optional Fields

FieldTypeDescription
envobjectEnvironment variables passed to pipelines

Pipeline Configuration

deploy

Configure the pipeline triggered when deploying the service.

destroy

Configure the pipeline triggered when tearing down the environment.

Environment Variables

Pass environment variables to both deploy and destroy pipelines:

Environment variables defined in env are passed to both deploy and destroy pipelines. Use template variables to reference other services.

How It Works

  1. When an environment is deployed, Lifecycle triggers the deploy pipeline with the configured environment variables.
  2. The pipeline receives context about the deployment including branch, namespace, and service information.
  3. When the environment is torn down, Lifecycle triggers the destroy pipeline to clean up resources.

Use Cases

  • Complex build processes - When builds require multi-stage pipelines or custom tooling
  • External dependencies - When deployment requires interaction with external systems
  • Existing CI/CD - When you have established Codefresh pipelines you want to reuse
  • Custom deployment logic - When standard Kubernetes deployment isn’t sufficient
⚠️

Codefresh pipelines run asynchronously. Lifecycle tracks pipeline status but the actual deployment logic is managed by Codefresh.

Finding Pipeline IDs

To find your Codefresh pipeline ID:

  1. Open your pipeline in Codefresh
  2. The pipeline ID is in the URL: https://g.codefresh.io/pipelines/edit/new/.../<pipeline-id>
  3. Or use the Codefresh CLI: codefresh get pipelines