Creating pipelines from the GUI
A pipeline defines the set of operations for a service, such as
Docker image build, push to Docker registry, integration tests, unit tests, deployment and so on. You can trigger pipelines manually by clicking BUILD, or automatically by different triggers.
To navigate to the service’s pipeline configuration page, click the Pipeline button for the service.
Name Your Pipeline
In the Name text box, type a name for your pipeline. The default name for the pipeline is the name of the service.
A service might have multiple pipelines. Each pipeline must have a unique name.
You can configure your pipeline to run according to the steps defined in a codefresh.yml file. Toggle the Use YML build option to the on position to use YML file builds. For the
YML File Location specify the path to the
codefresh.yml of your repository. Go to Codefresh YAML to learn more about how to configure your YML settings.
Enabling Auto Build / Webhook Settings
To automatically trigger your pipeline, set a webhook on your repository. On the pipeline configuration page, toggle the ADD WEBHOOK option to the on position.
You can define the webhook configuration to only trigger specific branches. Select the CUSTOM REGEX option at the TRIGGER FLOW ON field, and set a regular expression. Only branches that match the regular expression trigger the pipeline.
For example, if you want to trigger a build after commits to several branches, you can use the expression
For a single branch, use the expression
Only repository owners can set webhooks.
Badges are simple images that show you the last build status. They support both the pipeline and branch service status.
The badges can be embedded into your repository’s
Go to Build badges to learn more about how to add the badges to your repository.
Each of our pipelines uses a dedicated volume image. This volume allows us to speed up the build process. If the need arises you can access that volume to help you debug your build process. Go to Access and debug the pipeline volume image to learn more about it.
Name Your Docker Image
On the pipeline configuration page, in the Image Name text box, type a name for the Docker image that is built in the pipeline.
The image name must be in the format of
**Default image’s tag**
Codefresh assigns a default tag to the image name, based on the branch name. For example, if the pipeline was triggered by a change in the ‘master’ branch, the image’s full name will be
A Dockerfile is a text document that contains all the commands a user can call from the command line to assemble an image. Dockerfile is used to instruct Docker how to build images automatically.
If you have a Dockerfile specify its path
Dockerfile in your repository.
If you don’t a Dockerfile or a Codefresh YAML then you can create one using Codefresh templates. Choose the
Codefresh template Dockerfile and select a template. You can leave it as is or use it as a starting point.
Unit Test Script
This bash script is executed within a freshly created docker container that’s derived from the image that you build. This means that on top your code, all tools and resources that are provided by the image you build are available to this script. Here’s the place to execute commands that unit test your code and your resources. The exit code of your script determines the outcome of the test; Exiting with status code 0 will result in success, while exiting with code 1 and above will result in a failure.
Sometimes running unit tests require some additional services such as a Database (Mongo, MySql, Postgres etc) or third-party components like Redis, Memcache, etc. Codefresh provides you an easy way to do this by using a Codefresh pipeline and docker-compose. To run Unit Tests with a DB or other services you can create a composition and run your unit tests as part of it.
Go to Unit Tests to learn more about how to use it. Also, see how to run unit tests with composition:
Push to Docker Registry
Codefresh enables you to integrate with several Docker container registries. You can add new Docker registry on the Integration page.
Go to Docker Registry to learn more about how to configure it.
If your service is part of a micro-services type of application, Codefresh enables you to run your image as part of a composition, and then run your integration tests against it. There are two pre-requisites for this step:
- Define a Composition.
- Create a Composition test image, which is a Docker image with the integration test’s execution engine and scripts.
Go to Integration Tests to learn more about how to configure it.
In the deploy section of the pipeline configuration page, you can set an automatic deployment bash script command to be executed when all previous steps in the pipeline are successfully completed or just use
Codefresh's Deploy Images to deploy to:
- Docker Swarm
- Amazon ECS