Tasks

The tasks section defines a list of tasks that are part of the workflow.

Each task contains a series of minimal logical actions, the cubes. The result of a task is when all its cubes are completed.

In tasks, you can use environment variables as well as secrets.

You can set up a particular task either within the workflows:tasks section or in the separate tasks section with a link to it from workflows:tasks. The task description format for both options is the same.

Examples:

  • Task within the workflows:tasks section:

    workflows:
      my-workflow:
        tasks:
          - name: my-task
              cubes:
      	  ...
    
  • Task in the separate tasks section:

    tasks:
      - name: common-task
    
    workflows:
      my-workflow:
        tasks:
          - common-task
    
  • Multiple tasks in the separate tasks section:

    tasks:
      - name: common-task-1
      - name: common-task-2
    
    workflows:
      my-workflow:
        tasks:
          - [common-task-1, common-task-2]
    
  • Combined task specification option:

    tasks:
      - name: common-task-1
      - name: common-task-2
      - name: common-task-3
    
    workflows:
      my-workflow:
        tasks:
          - common-task-1
          - [common-task-2, common-task-3]
          - name: my-task
              cubes:
        ...
    

The following parameters are supported:

  • name: Task name.
  • cubes: List of cubes to be executed as part of the task.

cubes

The cubes section lists the minimal logical actions, cubes, to execute in the task.

In cubes, you can use environment variables as well as secrets.

The following parameters are supported:

  • name: Cube name.
  • script: Command to be executed in the cube.
  • needs: List of cubes to be executed before the current one.
  • image: (Optional) Docker image used to execute the cube.

image

The image section contains parameters of the Docker image used to execute the cube.

You can specify a standard Docker image name or a path in a particular registry.

If the image section is not specified, the commands will be executed in Linux environment.

Examples:

  • Specifying a standard Docker image name:

    workflows:
      my-workflow:
        tasks:
          - name: my-task
        	  cubes:
              - name: my-cube
                image: ubuntu:22.04
                script: echo "hello world!"
    
  • Specifying a path in a particular registry:

    workflows:
      my-workflow:
        tasks:
          - name: my-task
        	  cubes:
              - name: my-cube
                image: cr.yandex/mirror/ubuntu:22.04
                script: echo "hello world!"
    

If authentication is required to access the registry, you can use the docker login command in your task or configure authentication in the image section, e.g.:

workflows:
  my-workflow:
    tasks:
      - name: my-task
    	  cubes:
          - name: my-cube
            image:
              name: some-docker-registry.com/account-name/ubuntu:22.04
              username: username 
              password: password

See also