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
| Field | Type | Description |
|---|---|---|
repository | string | GitHub repository in owner/repo format |
branchName | string | Branch to build from |
deploy.pipelineId | string | Codefresh pipeline ID for deployment |
deploy.trigger | string | Pipeline trigger name for deployment |
destroy.pipelineId | string | Codefresh pipeline ID for destruction |
destroy.trigger | string | Pipeline trigger name for destruction |
Optional Fields
| Field | Type | Description |
|---|---|---|
env | object | Environment 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
- When an environment is deployed, Lifecycle triggers the
deploypipeline with the configured environment variables. - The pipeline receives context about the deployment including branch, namespace, and service information.
- When the environment is torn down, Lifecycle triggers the
destroypipeline 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:
- Open your pipeline in Codefresh
- The pipeline ID is in the URL:
https://g.codefresh.io/pipelines/edit/new/.../<pipeline-id> - Or use the Codefresh CLI:
codefresh get pipelines