Drone CI 中文文档

Host Volumes

Host mounts allow you to mount an absolute path on the host machine into a pipeline step. This setting is only available to trusted repositories.

This setting is only available to trusted repositories, since mounting host machine volumes is a security risk.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
kind: pipeline
type: vm
name: default

pool:
  use: ubuntu

steps:
- name: build
  image: node
  volumes:
  - name: cache
    path: /tmp/cache
  commands:
  - npm install
  - npm test

volumes:
- name: cache
  host:
    path: /var/lib/cache

The first step is to define the host machine volume path. The host volume path must be an absolute path.

15
16
17
18
volumes:
- name: cache
  host:
    path: /var/lib/cache

The next step is to configure your pipeline step to mount the named host path into your container. The container path must also be an absolute path.

 5
 6
 7
 8
 9
10
steps:
- name: build
  image: node
  volumes:
  - name: cache
    path: /tmp/cache