---
metadata:
  - name: generator
    content: Diplodoc Platform v5.57.3
alternate:
  - https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/workers.md
  - https://sourcecraft.dev/portal/docs/ru/sourcecraft/concepts/workers.md
  - href: en/sourcecraft/concepts/workers.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# SourceCraft CI/CD workers

A _worker_ is a virtual machine, physical server, or serverless container used to run CI/CD workflows.

All [cubes](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd.md#cubes) within a single [task](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd.md#tasks) run on the same worker.

The following worker types are supported:
* [Cloud workers](#cloud-workers)
* [Serverless workers](#serverless-workers)
* [Self-hosted workers](#self-hosted-workers)

### Cloud workers {#cloud-workers}

_Cloud workers_ are cloud-based virtual machines provided by SourceCraft. They are the default resource for CI/CD workflows.

Cloud worker computing resources have the following configuration: 4 vCPUs, 8 GB RAM. {#cloud-worker-resources}

### Serverless workers {#serverless-workers}

_Serverless workers_ are cloud-based serverless containers provided by SourceCraft. Unlike cloud workers, serverless workers spin up almost instantly as they do not wait for a VM to boot.

The following limitations apply:
* Only [Yandex Container Registry](https://yandex.cloud/en/docs/container-registry/) is supported for Docker cubes.
* You cannot run `docker` or `docker-compose` within a cube.
* One task may include up to nine unique custom Docker images.

To run a CI/CD process on a serverless worker, specify `runs_on: serverless` in the [workflow](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd.md#workflows) (`workflow`) or [task](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd.md#tasks) (`task`) parameters.

If `runs_on` is not specified in `task`, it will default to the parameter from `workflow:runs_on`.

#### Example of running the whole workflow on a serverless worker {#serverless-workflow-example}

```yaml
workflows:
  workflow-in-serverless-mode:
    runs_on: serverless
  
    tasks:
      - name: task1-in-serverless-mode
        cubes:
          - name: hello
            script:
              - echo "hello from serverless"

      - name: task2-in-serverless-mode
        cubes:
          - name: hello
            script:
              - echo "hello from serverless again"
```

#### Example of running an individual task on a serverless worker {#serverless-task-example}

```yaml
workflows:
  workflow1:
  
    tasks:
      - name: task1-in-compute-mode
        cubes:
          - name: hello
            script:
              - echo "hello from compute"

      - name: task2-in-serverless-mode
        runs_on: serverless
        cubes:
          - name: hello
            script:
              - echo "hello from serverless"
```

### Self-hosted workers {#self-hosted-workers}

<!-- source: en/_includes/sourcecraft/ci-cd/self-hosted-intro.md -->
_Self-hosted workers_ are users’ personal servers, both virtual and physical, on which CI/CD processes run. These processes will have access to the user server environment.

Restrictions on the [amount of computing resources](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/workers.md#cloud-worker-resources) do not apply to self-hosted workers, and they also do not consume the [total CI/CD runtime quota](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/limits.md#ci-cd-quotas).
<!-- endsource: en/_includes/sourcecraft/ci-cd/self-hosted-intro.md -->

Custom workers can run tasks directly on the server or in a Kubernetes cluster. In Kubernetes mode, each task runs in a separate [pod](https://kubernetes.io/docs/concepts/workloads/pods/) from a pool provisioned in advance.

For more information, see these pages:
* [Setting up a self-hosted worker for SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/self-hosted-worker.md)
* [Setting up the execution of SourceCraft CI/CD jobs in a Kubernetes cluster](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/self-hosted-worker-kubernetes.md)
* [Deploying a self-hosted SourceCraft worker on a Yandex Compute Cloud VM](https://sourcecraft.dev/portal/docs/en/sourcecraft/tutorials/self-hosted-worker-sourcecraft.md)

<!-- source: en/_includes/sourcecraft/ci-cd/how-to-run-on-self-hosted.md -->
To run a CI/CD process on a custom self-hosted worker, specify `runs_on: self-hosted` in the [workflow](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd.md#workflows) (`workflow`) or [task](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd.md#tasks) (`task`) parameters.

If `runs_on` is not specified in `task`, the parameter from `workflow:runs_on` will be used by default.
<!-- endsource: en/_includes/sourcecraft/ci-cd/how-to-run-on-self-hosted.md -->

#### Example of running the whole workflow on a self-hosted worker {#serverless-workflow-example}

<!-- source: en/_includes/sourcecraft/ci-cd/config-self-hosted-ci.md -->
```yaml
workflows:
  my-awesome-workflow:
    runs_on: self-hosted
    
    tasks:
      - name: self-hosted-task
        cubes:
          - name: hello
            script:
              - echo "hello from self-hosted"

      - name: self-hosted-go-builder-task
        runs_on: [self-hosted, go-builder]
        cubes:
          - name: hello
            script:
              - echo "hello from self-hosted go builder"
```

In this case, tasks from `my-awesome-workflow` will run on any of your self-hosted workers by default unless their `runs_on` parameter is redefined. At the same time, `self-hosted-go-builder-task` will run only on the self-hosted worker assigned the `go-builder` tag during initialization.
<!-- endsource: en/_includes/sourcecraft/ci-cd/config-self-hosted-ci.md -->

[Learn more about worker tags](https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/self-hosted-tags.md).
