You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,9 +24,17 @@ Whether to pass `--no-cone` to `git sparse-checkout` so that the paths are consi
24
24
25
25
Whether to skip ssh-keyscan step. This will skip adding each ssh public key into the known-hosts file. Only use if ssh keys are already setup.
26
26
27
+
#### `clean_checkout` ('true' or 'false')
28
+
29
+
Whether to perform aggressive repository cleanup before checkout. This option handles scenarios where interrupted or cancelled jobs leave the git repository in a corrupted state with uncommitted changes that would prevent checkout. When enabled, it performs `git reset --hard HEAD` and `git sparse-checkout disable` in addition to the normal cleanup.
30
+
31
+
**⚠️ Warning:** This option will destroy ALL local changes and remove ALL untracked files. The `git clean -ffxdq` command with the `-x` flag will also remove ignored files (such as credentials, local configuration, or cache files). Only use this option when you're certain no important local data needs to be preserved.
32
+
33
+
Use this option for pipeline upload jobs that don't need to preserve local changes.
34
+
27
35
## Example
28
36
29
-
Below is an example for using sparse-checkout plugin.
37
+
Below is an example of using sparse-checkout plugin.
30
38
31
39
```yaml
32
40
steps:
@@ -38,6 +46,21 @@ steps:
38
46
- .buildkite
39
47
```
40
48
49
+
### Handling corrupted repository states
50
+
51
+
If your jobs are frequently cancelled during the git clone phase, you may encounter failures due to uncommitted changes left in the repository. Use the `clean_checkout` option to handle this:
52
+
53
+
```yaml
54
+
steps:
55
+
- label: "Pipeline upload with clean checkout"
56
+
command: "buildkite-agent pipeline upload"
57
+
plugins:
58
+
- sparse-checkout#v1.1.0:
59
+
paths:
60
+
- .buildkite
61
+
clean_checkout: true
62
+
```
63
+
41
64
## ⚒ Developing
42
65
43
66
To run testing, shellchecks and plugin linting use `bk run` with the [Buildkite CLI](https://github.com/buildkite/cli).
0 commit comments