Updated 2 years ago by Admin

Drone automatically creates a temporary volume, known as your workspace, where it clones your repository. The workspace is the current working directory for each step in your pipeline.

Because the workspace is a volume, filesystem changes are persisted between pipeline steps. In other words, individual steps can communicate and share state using the filesystem.

Workspace volumes are ephemeral. They are created when the pipeline starts and destroyed after the pipeline completes.

Customizing the Workspace

You can customize the workspace directory by defining the workspace section in your yaml. Here is a basic example:

1   kind: pipeline
2 type: docker
3 name: default
5 workspace:
6 path: /drone/src
8 steps:
9 - name: backend
10 image: golang:latest
11 commands:
12 - go get
13 - go test
15 - name: frontend
16 image: node:latest
17 commands:
18 - npm install
19 - npm run tests

This would be equivalent to the following docker commands:

$ docker volume create my-named-volume
$ docker run --volume=my-named-volume:/drone/src golang
$ docker run --volume=my-named-volume:/drone/src node

How did we do?