Learn the types of Pipeline steps
Codefresh pipelines are composed of a series of steps.
You can create your own pipelines by writing a codefresh.yml file that describes your pipeline. This file can then be version controlled on its own (pipeline as code).
The steps offered by Codefresh are:
Git clone steps allow you to checkout code in your pipeline from any internal or external repository. Existing accounts that still use repositories instead of projects have an implicit clone step in the pipelines.
Freestyle steps are the cornerstone of Codefresh pipelines. They allow you to run any command within the context of a Docker container. A lot of Codefresh optimizations such as the shared docker volume are designed specifically for freestyle steps.
Freestyle steps are a secure replacement for
docker run commands.
Build steps are the main way where you get access to the Docker daemon (Docker as a service) in Codefresh pipelines. Build steps take as input any Dockerfile and run it on the cloud in a similar manner to what you do on your workstation. Build steps automatically push the result to the internal Docker registry (no need for docker login commands). Codefresh also comes with a global Docker cache that automatically gets attached to all build nodes. Build steps are a secure replacement for
docker build commands.
Push steps allow you to push and tag your docker images (created by the build step) in any external Docker registry. Push steps are not needed at all if you work with only the internal Codefresh registry. Push steps are a secure replacement for the
docker tag and
docker push commands.
Composition steps allow you to run multiple services together in the Codefresh infrastructure and execute unit tests or other commands against them. They are discarded once a pipeline finishes. Composition steps are a secure replacement for
Launch test environment steps behave similar to compositions, but they persist after the pipeline ends. This is a great way to create preview environment from your pull requests and send to colleagues.
Deploy steps allow you to perform Kubernetes deployments in a declarative manner. They embody the Continuous Deployment aspect of Codefresh.
Approval steps allow you to pause pipelines and wait for human intervention before resuming. They allow you to embrace the concepts of Continuous Delivery.
In the case of freestyle steps we also offer a plugin marketplace with several existing plugins for popular integrations.
Codefresh steps can be:
- Private (visible only to you and your team) or public (visible to everybody via the marketplace)
- Official (supported by the Codefresh team) or community based
- Ready for production or still incubating.
You can use any your pipelines any of the public steps already in the marketplace, any steps created by your team and any steps that you create for yourself.
Using custom pipeline steps
When you create a pipeline, you will have access to two categories of steps:
- Public steps that exist in the marketplace
- Steps that you or your team have created (visible only to you)
To use a step, first click on the pipeline section where you want to insert the step. You will get a new dialog with all the details of the step along with a live preview of the exact yaml that will be inserted in your pipeline.
For all steps you can define:
- The title of the text (which will also be visible in the pipeline UI)
- A freetext description
- The stage that will contain the step
The rest of the fields are specific to each step. See the documentation of each step in order to understand what each field should contain. There are fields for each step that are marked as required and are essential for the step to work. These are marked with an asterisk.
Once a step is added to the pipeline, you are fee to change the resulting yaml even further by just typing in the pipeline editor.
Creating your own step
- The step description in the special yaml syntax for describing Codefresh steps
- A Docker images that implements the step (optional)
The easiest way to create your own step is to start by using the definition of an existing step.
Here is the resulting yaml:
For each step you define the following sections:
- Metadata to describe the characteristics of the step
- The description of its arguments
- The implementation (i.e. what yaml gets inserted in the pipeline)
For the metadata section note the following:
isPublicdecides if this step is visible only to your and your team, or visible to all (in the marketplace)
nameof the step must be prefixed with your Codefresh account name. Steps created by the Codefresh team are on the root level of the hierarchy (without prefix). This is the same pattern that Dockerhub is using for images.
stageshown if this step is ready for production or still incubating. This is just an indication to users. It doesn’t affect the implementation of the step in any way
icon. Ideally you provide a transparent svg so that the icon is scalable. The icon for a step is used both in the marketplace as well as the pipeline view. You can also select a default background to be used. Alternatively, you can define jpg/png icons for large/medium/small sizes. We suggest the svg approach
examplessection will be shown in the marketplace as documentation for your step
The final part is the implementation. Here you can define exactly that yaml that this step will insert in the pipeline. You can use any of the built-in steps in Codefresh and even add multiple steps.
Once you are done with your step, use the Codefresh CLI to upload it to the marketplace. If you want the step to be available only to you and your team make sure that the property
isPublic is false (and then it will not be shown in the marketplace).
If you want to remove your step from the marketplace, you can delete it