Codefresh Service
Trigger external Codefresh pipelines for deployment and teardown.
The codefresh Service uses external Codefresh pipelines for deployment. Use
it when existing CI/CD pipelines contain 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 |
destroy.pipelineId | string | Codefresh pipeline ID for destruction |
Optional fields
| Field | Type | Description |
|---|---|---|
env | object | Environment variables passed to pipelines |
deploy.trigger | string | Pipeline trigger name for deployment |
destroy.trigger | string | Pipeline trigger name for destruction |
Set repository, branchName, and both pipeline IDs. A missing pipeline ID
causes the related deployment or teardown operation to fail.
Authentication
Before you run Codefresh Services or the Docker ci builder, configure
CODEFRESH_API_KEY in Lifecycle. Ask the operator to supply this credential
through the approved Secret process. Use the same process to rotate it. Do not
put it in lifecycle.yaml.
Pipeline configuration
deploy
Configure the pipeline that deploys the Service.
destroy
Configure the pipeline that tears down the Environment.
Environment variables
Pass environment variables to the deploy and destroy pipelines:
Environment variables in env go to the deploy and destroy pipelines.
Template variables can refer to other Services. Full-value cloud secret
references resolve before invocation. More information is in Cloud
Secrets.
How it works
- When Lifecycle deploys an Environment, it triggers the
deploypipeline with the configured environment variables. - The pipeline receives the branch, namespace, and Service information.
- When Lifecycle tears down the Environment, it triggers the
destroypipeline to remove resources.
Typical tasks
- Complex builds — Multi-stage pipelines or custom tooling.
- External dependencies — Deployments that interact with external systems.
- Existing CI/CD — Established Codefresh pipelines.
- Custom deployment logic — Deployments that standard Kubernetes configuration cannot express.
Codefresh pipelines run asynchronously. Lifecycle tracks pipeline status but Codefresh manages the deployment logic.
Find pipeline IDs
To find your Codefresh pipeline ID:
- Open your pipeline in Codefresh.
- Find the pipeline ID in the URL:
https://g.codefresh.io/pipelines/edit/new/.../<pipeline-id>. - Or, run
codefresh get pipelines.