Steps

Overview

Steps are the bread and butter of every pipeline. They are operations that will be executed during the pipeline execution. Steps are run in the order defined in the steps field in pipeline spec.

When one of the steps fail, failure handlers are executed and the pipeline finishes. No other steps in the pipeline will run.

Note

Currently IceCI does not support parallel pipeline execution. This feature is considered for future versions.

Every step is executed in a container, running as a pod in Kubernetes cluster. Every step has the same volume mounted in the /workspace directory inside the container running the step. This volume contains source code related to the Git event that occurred in the git repository. The volume is persistent across the whole pipeline and is isolated from other pipelines.

Note

If you create files in the /workspace directory in any of your steps during pipeline execution, all the subsequent steps will have access those files.

Examples

Simple steps

Here’s an example of a working pipeline having 2 simple docker run steps.

steps:
- name: step1
  dockerRun:
    image: busybox
    script: "echo 'Hello world!'"

- name: step2
  dockerRun:
    image: busybox
    script: |
      echo "step 2"
      env

Persistent workspace

An example of generating a file and then accessing it in next step.

steps:
- name: generate-date
  dockerRun:
    image: busybox
    script: "date > date.log"

- name: print-date
  dockerRun:
    image: busybox
    script: "cat date.log"

Environment variables

Here’s an example of passing environment variables to a container.

steps:
- name: env-test
  dockerRun:
    image: busybox
    script: "printenv ENV_VAR_1"
    environment:
    - name: ENV_VAR_1
      value: test-value

Note

As you can see, the environment variable value is hardcoded into the pipeline. This is fine if your build configuration doesn’t contain passwords or other sensitive data. For more information on how to manage sensitive data in IceCI see secrets section.

Files

Here’s an example of mounting files from a secret in a container.

steps:
- name: file-test
  dockerRun:
    image: busybox
    script: "cat /mnt/file"
    files:
    - path: /mnt/file
      fromSecret: file-secret

Note

The content of a file can’t be defined inline. Every file has to have a reference to a secret, from which the content is pulled.

Further reading

For more information about steps and their specification see Step