Skip to content

Commit 12dcab4

Browse files
authored
Document config options formally (#187)
1 parent 760fc99 commit 12dcab4

File tree

1 file changed

+73
-50
lines changed

1 file changed

+73
-50
lines changed

README.md

Lines changed: 73 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -34,78 +34,101 @@ steps:
3434
3535
`P4PORT` may also be configured by setting `BUILDKITE_REPO` for your pipeline.
3636

37-
### Custom workspace view:
37+
## Configuration
3838

39-
Note that this must consist of real depot paths like a regular workspace view. You cannot combine streams.
39+
### Basic
4040

41-
```yaml
42-
steps:
43-
plugins:
44-
- improbable-eng/perforce:
45-
view: >-
46-
//dev/project/... project/...
47-
//dev/vendor/... vendor/...
48-
```
41+
#### `p4user/p4port/p4tickets/p4trust` (optional, string)
4942

50-
### Workspace view via a p4 stream:
43+
Override configuration at the User Environment level. May be overridden by P4CONFIG or P4ENVIRO files.
5144

52-
```yaml
53-
steps:
54-
plugins:
55-
- improbable-eng/perforce:
56-
stream: //dev/minimal
57-
```
45+
See [p4 set](https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_set.html?Highlight=precedence) for more on system variables and precedence.
46+
47+
#### `stream` (optional, string)
48+
49+
Which p4 stream to sync, e.g. `//dev/minimal`. Can be overridden by `view`.
5850

59-
### Partial sync of a stream
51+
#### `sync` (optional, []string)
52+
53+
List of paths to sync, useful when only a subset of files in the clients view are required.
6054

6155
```yaml
62-
steps:
63-
plugins:
64-
- improbable-eng/perforce:
65-
stream: //dev/minimal
66-
sync:
67-
- //dev/minimal/.buildkite/...
68-
- //dev/minimal/scripts/...
56+
sync:
57+
- //dev/minimal/.buildkite/...
58+
- //dev/minimal/scripts/...
6959
```
7060

71-
### Enable parallel sync
61+
#### `view` (optional, string)
62+
63+
Custom workspace view. Must consist of concrete depot paths. Overrides `stream`.
7264

7365
```yaml
74-
steps:
75-
plugins:
76-
- improbable-eng/perforce:
77-
parallel: 16
66+
view: >-
67+
//dev/project/... project/...
68+
//dev/vendor/... vendor/...
7869
```
7970

80-
### Share a stream workspace between pipelines
71+
### Advanced
72+
73+
#### `backup_changelists` (optional, bool)
74+
75+
Default: `no`.
76+
77+
When running a build against a shelved changelist, create a duplicate of that changelist so that other steps in the build are guaranteed to run against the same version of shelved files.
78+
79+
Caveats:
80+
81+
* May lead to accumulation of many shelved changelists on the server, affecting performance.
82+
* Removes convenience of being able to re-shelve changes and iterate by retrying only failied steps.
83+
84+
#### `client_options` (optional, string)
8185

82-
Useful to avoid syncing duplicate data with large workspaces.
83-
Only allowed when there is a single buildkite agent running on the machine.
86+
Default: `clobber`.
87+
88+
Additional options for the client workspace, see [Options field](https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_client.html?#Options2).
8489

8590
```yaml
86-
steps:
87-
plugins:
88-
- improbable-eng/perforce:
89-
stream: //dev/buildkite
90-
# Sync each stream once
91-
share_workspace: true
92-
# Sync once and switch streams in-place (requires share_workspace: true)
93-
stream_switching: true
91+
client_options: noclobber nowriteall
9492
```
9593

96-
### Use readonly/partitioned clients
94+
#### `client_type` (optional, string)
95+
96+
Default: `writeable`.
9797

98-
Readonly and partitioned client workspaces can be used to reduce impact of automated build systems on Perforce server performance.
98+
`readonly` and `partitioned` client workspaces can be used to reduce impact of automated build systems on Perforce server performance.
9999
See related article [Readonly and Partitioned Client Workspaces](https://community.perforce.com/s/article/15372).
100100

101-
Note that existing client workspaces must be deleted and re-created to change type.
101+
Note that `writeable` client workspaces must be deleted and re-created to change to `readonly` or `partitioned` and vice versa.
102102

103-
```yaml
104-
steps:
105-
plugins:
106-
- improbable-eng/perforce:
107-
client_type: partitioned
108-
```
103+
Note that `readonly` or `partitioned` workspaces do not appear in the `db.have` table, which prevents them from being used as a revision specifier.
104+
105+
This adds a caveat if you wish to re-use workspace data across different machines: the original client which populated that workspace must have been `writeable`.
106+
107+
(e.g. If a disk with existing workspace data is attached to a new machine, the plugin will create a new client, read the old workspace name from P4CONFIG and `p4 flush //...@<old-workspace>`. The flush command fails if the old workspace was not of type `writeable`)
108+
109+
#### `parallel` (optional, string)
110+
111+
Default: `0` (no parallelism)
112+
113+
Number of threads to use for parallel sync operations. High values may affect Perforce server performance.
114+
115+
#### `share_workspace` (optional, bool)
116+
117+
Default: `no`
118+
119+
Allow multiple Buildkite pipelines to share each stream-specific client workspace.
120+
121+
Useful to avoid syncing duplicate data for large workspaces.
122+
123+
Can only be used with stream workspaces and when no more than one buildkite-agent process is running on that machine.
124+
125+
#### `stream_switching` (optional, bool)
126+
127+
Default: `no`
128+
129+
Allows multiple Buildkite pipelines to share a single client workspace, switching streams as required.
130+
131+
Must have `share_workspace: yes` to take effect.
109132

110133
## Triggering Builds
111134

0 commit comments

Comments
 (0)