barckcode commited on
Commit
a87a9e2
·
verified ·
1 Parent(s): 3e013e5

Add files using upload-large-folder tool

Browse files
README.md ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: odc-by
3
+ pretty_name: The Stack v3 DevOps Corpus
4
+ size_categories:
5
+ - 10M<n<100M
6
+ task_categories:
7
+ - text-generation
8
+ language:
9
+ - code
10
+ tags:
11
+ - infrastructure-as-code
12
+ - devops
13
+ - kubernetes
14
+ - helm
15
+ - terraform
16
+ - ansible
17
+ - docker
18
+ - github-actions
19
+ - sre
20
+ configs:
21
+ - config_name: helm_chart
22
+ data_files:
23
+ - split: train
24
+ path: data/helm_chart/train-*.parquet
25
+ - config_name: terraform_module
26
+ data_files:
27
+ - split: train
28
+ path: data/terraform_module/train-*.parquet
29
+ - config_name: manifest_set
30
+ data_files:
31
+ - split: train
32
+ path: data/manifest_set/train-*.parquet
33
+ - config_name: ansible_role
34
+ data_files:
35
+ - split: train
36
+ path: data/ansible_role/train-*.parquet
37
+ - config_name: dockerfile
38
+ data_files:
39
+ - split: train
40
+ path: data/dockerfile/train-*.parquet
41
+ - config_name: workflow
42
+ data_files:
43
+ - split: train
44
+ path: data/workflow/train-*.parquet
45
+ - config_name: compose
46
+ data_files:
47
+ - split: train
48
+ path: data/compose/train-*.parquet
49
+ ---
50
+
51
+ # The Stack v3 DevOps Corpus
52
+
53
+ 13,234,862 complete infrastructure units extracted from
54
+ [The Stack v3](https://huggingface.co/datasets/HuggingFaceCode/stack-v3-train),
55
+ grouped into seven classes and gated on content rather than popularity.
56
+
57
+ A unit is not a file, it is the thing an engineer would actually run: a Helm chart
58
+ arrives with its `Chart.yaml`, `values.yaml` and every template; a Terraform module
59
+ with all of its `.tf` files; an Ansible role with its tasks, defaults and handlers.
60
+ That is only possible because The Stack v3 groups rows by repository, which v2 did
61
+ not.
62
+
63
+ ## Why this exists
64
+
65
+ Language detection cannot find infrastructure code. Helm templates, Kubernetes
66
+ manifests, Ansible playbooks, CI pipelines and Prometheus rules are all just
67
+ `YAML` to `go-enry`, and **59.6% of the YAML in the corpus is not infrastructure
68
+ at all** (Spring config, i18n plurals, Drupal exports, dbt models, Conda
69
+ environments). Path heuristics do not fix it either: a directory-name rule finds
70
+ only **33% of real Kubernetes manifests** and is **57% precise**.
71
+
72
+ So classification here is content-first. Every YAML unit was parsed and inspected,
73
+ and the resulting labels were scored against an independent YAML parser rather
74
+ than against more regexes:
75
+
76
+ | Class | Precision | Recall |
77
+ |---|---|---|
78
+ | kubernetes | 97.8% | 97.2% |
79
+ | github_actions | 98.9% | 100.0% |
80
+ | compose | 97.2% | 99.3% |
81
+ | helm | 93.9% (structural) | not measurable, templates are not valid YAML |
82
+ | ansible | 86.4% | 90.3% |
83
+ | terraform | 98.9% (extension-anchored) | |
84
+ | dockerfile | 99.7% (extension-anchored) | |
85
+
86
+ Roughly half of all Helm and Ansible labels come from repository context alone:
87
+ a `values.yaml` or a `defaults/main.yml` is a bare tree of variables, and no
88
+ amount of content inspection can tell you what it belongs to.
89
+
90
+ ## Configs
91
+
92
+ | Config | Units | Parquet | What a unit is |
93
+ |---|---|---|---|
94
+ | `helm_chart` | 65,422 | 0.15 GB | Complete charts: `Chart.yaml` plus templates, and `values.yaml` where present |
95
+ | `terraform_module` | 779,730 | 1.06 GB | Directories with two or more `.tf` files declaring real blocks |
96
+ | `manifest_set` | 743,191 | 0.42 GB | Directories of two or more Kubernetes manifests that parse |
97
+ | `ansible_role` | 444,411 | 0.34 GB | Roles with a verifiable task list, plus defaults, handlers and templates |
98
+ | `dockerfile` | 4,609,451 | 1.14 GB | Single files containing real Dockerfile instructions |
99
+ | `workflow` | 3,380,313 | 1.41 GB | GitHub Actions workflows with triggers and jobs |
100
+ | `compose` | 3,212,344 | 0.87 GB | Docker Compose files with a services mapping |
101
+ | **total** | **13,234,862** | **5.40 GB** | |
102
+
103
+ ### What is inside each one
104
+
105
+ - **`helm_chart`** the scarcest and richest class. `Chart.yaml`, `values.yaml`
106
+ where present, every template and helper. Median 4 templates, up to 56.
107
+ - **`terraform_module`** a directory of two or more `.tf` files that declare real
108
+ resources, modules, variables or outputs. Median 3 files. 70.7% declare
109
+ variables, 47.8% outputs.
110
+ - **`manifest_set`** a directory of two or more Kubernetes manifests that parse.
111
+ Median 3. Most common kinds: Deployment, Service, Kustomization, ConfigMap,
112
+ Ingress, PersistentVolumeClaim, Secret.
113
+ - **`ansible_role`** `tasks/`, and whichever of `defaults/`, `handlers/`, `vars/`,
114
+ `meta/`, `templates/`, `files/` the role ships. 24.6% carry defaults.
115
+ - **`dockerfile`** one file with real instructions. Median 8 instructions,
116
+ 20.3% multi-stage.
117
+ - **`workflow`** one GitHub Actions workflow with triggers and jobs. Median 1 job
118
+ and 5 steps.
119
+ - **`compose`** one Compose file with a services mapping. Median 2 services.
120
+
121
+ ### Using it
122
+
123
+ ```python
124
+ from datasets import load_dataset
125
+
126
+ charts = load_dataset("Helmcode/stack-v3-devops", "helm_chart", split="train")
127
+ ```
128
+
129
+ Charts that render standalone, which is what an executable benchmark needs:
130
+
131
+ ```python
132
+ renderable = charts.filter(lambda row: row["flags"]["self_contained"])
133
+ ```
134
+
135
+ Stream the large configs instead of downloading them:
136
+
137
+ ```python
138
+ dockerfiles = load_dataset(
139
+ "Helmcode/stack-v3-devops", "dockerfile", split="train", streaming=True
140
+ )
141
+ hardened = (row for row in dockerfiles if row["flags"]["pins_digest"])
142
+ ```
143
+
144
+ Reconstruct a unit as files on disk, which is how you feed it to `helm lint`,
145
+ `terraform validate` or `hadolint`:
146
+
147
+ ```python
148
+ import pathlib
149
+
150
+ def materialise(row, root):
151
+ prefix = row["unit_prefix"]
152
+ for entry in row["files"]:
153
+ relative = entry["path"][len(prefix):].lstrip("/") if prefix else entry["path"]
154
+ target = pathlib.Path(root, relative or pathlib.Path(entry["path"]).name)
155
+ target.parent.mkdir(parents=True, exist_ok=True)
156
+ target.write_text(entry["content"])
157
+
158
+ materialise(charts[0], "/tmp/chart")
159
+ ```
160
+
161
+ Restrict to units whose every file carries a permissive license header, but read
162
+ the licensing section first, because that is not the same as permissively
163
+ licensed code:
164
+
165
+ ```python
166
+ permissive = charts.filter(lambda row: row["flags"]["all_permissive"])
167
+ ```
168
+
169
+ ### What it is good for
170
+
171
+ - **Evaluation.** Complete, self-contained units are what an executable benchmark
172
+ needs: render the chart, validate the module, lint the Dockerfile, and score on
173
+ whether real tools accept the output.
174
+ - **Fine-tuning on infrastructure tasks**, where the unit boundary matters more
175
+ than the file: a model that writes one template without `values.yaml` has not
176
+ written a chart.
177
+ - **Measuring practice.** The flags make questions like "what share of public
178
+ Dockerfiles run as root" answerable in one pass instead of a research project.
179
+
180
+ It is **not** a pretraining corpus. 5.4 GB is small, and the classes are
181
+ deliberately unbalanced towards what exists rather than what would balance nicely.
182
+
183
+ ## Schema
184
+
185
+ Every config shares a base schema and adds its own `quality` and `flags` structs.
186
+
187
+ | Field | Type | Notes |
188
+ |---|---|---|
189
+ | `unit_type` | string | one of the seven config names |
190
+ | `repo_path` | string | `owner/name`, for attribution |
191
+ | `commit_id` | string | the exact commit the files came from |
192
+ | `stars` | int32 | GitHub stars at crawl time |
193
+ | `unit_prefix` | string | directory the unit was rooted at, `""` for repo root |
194
+ | `shard` | int32 | source shard, for reproducibility |
195
+ | `license_types` | list\<string\> | distinct `license_type` values across the unit's files |
196
+ | `files` | list\<struct\> | `path`, `content`, `license_type`, `detected_licenses`, `size_bytes` |
197
+ | `quality` | struct | per class: template counts, stage counts, service counts, manifest kinds |
198
+ | `flags` | struct | derived booleans, below |
199
+
200
+ Flags worth knowing about:
201
+
202
+ - `self_contained` (helm_chart): the chart does not call a helper it lacks.
203
+ **72.9%** of charts qualify; the rest cannot be rendered
204
+ by `helm template` on their own.
205
+ - `pins_digest` / `uses_latest_tag` (dockerfile): supply-chain hygiene.
206
+ - `has_unpinned_action` (workflow): actions referenced by tag or branch instead of
207
+ a commit SHA.
208
+ - `all_permissive`: every file in the unit is labelled `permissive`. Read the
209
+ licensing section before relying on this.
210
+
211
+ ## What this corpus says about real-world infrastructure
212
+
213
+ Measured across every unit, not a sample:
214
+
215
+ - **89.0% of Dockerfiles set no `USER`**, so the container runs as root
216
+ - **98.6% of Dockerfiles declare no `HEALTHCHECK`**
217
+ - **89.5% of workflows declare no `permissions`**, inheriting the default token scope
218
+ - **91.1% of Compose files define no healthcheck**
219
+ - 20.3% of Dockerfiles are multi-stage
220
+ - Top Kubernetes kinds: Deployment, Service, Kustomization, ConfigMap, Ingress
221
+
222
+ That is the baseline any model trained on public infrastructure code will imitate,
223
+ which is the point of publishing it as a measurable corpus rather than a curated
224
+ showcase.
225
+
226
+ ## Provenance and how it was built
227
+
228
+ Built with [helmcode/stack-slice](https://github.com/helmcode/stack-slice)
229
+ (Apache-2.0). The corpus was surveyed and extracted **without downloading the
230
+ 4.71 TB dataset**: `content` is 96.9% of every shard, so a metadata-only pass
231
+ costs 1% of the bytes, and extraction streams shards over HTTP range requests
232
+ without ever storing one.
233
+
234
+ - Source revision: **`de81e3ca7151`** of `HuggingFaceCode/stack-v3-train`
235
+ - Shards swept: **8,196 of 8,196**, covering 157.9M repositories
236
+ - Forks skipped, so units come from the repository that authored them
237
+ - Re-filtered for opt-out against revision **`d7bc7991ea32`**
238
+ (see Licensing)
239
+
240
+ Gates are content-based, never popularity-based: a chart must have parseable
241
+ metadata, two or more templates and actual templating; a Terraform module must
242
+ declare real blocks and not be machine-generated; an Ansible role must have a task
243
+ list a parser accepts; a manifest set must have two or more manifests that load.
244
+
245
+ ## Licensing, and a finding you should not skip
246
+
247
+ This dataset is released under **ODC-By 1.0**, inherited from The Stack v3.
248
+ **The code inside remains under its original licenses**, and `repo_path` plus
249
+ `commit_id` are included on every unit precisely so attribution is possible.
250
+
251
+ **The `license_type` labels are header-based, not repository-based.** In the source
252
+ corpus only 3.41% of files are labelled `permissive` and 98.2% of repositories
253
+ contain none at all. Apache-2.0 is detected 26,624 times against MIT's 442, which
254
+ inverts their real popularity on GitHub: the Apache convention puts a license
255
+ header in every source file, while MIT projects ship a single root `LICENSE`. So
256
+ `license_type == permissive` means **"this file carries an inline license header"**,
257
+ not "this file comes from a permissively licensed project".
258
+
259
+ Two consequences:
260
+
261
+ 1. Filtering to `permissive` does not give you a representative permissive
262
+ corpus, it gives you an Apache-2.0-skewed slice.
263
+ 2. The remaining `no_license` majority is code with **no license grant at all**,
264
+ not code that is permissively licensed. Treat it accordingly.
265
+
266
+ The repository-level license cannot be recovered from within The Stack v3 either:
267
+ plain-text `LICENSE` files were dropped by its quality filter, so only 8 of 20,923
268
+ repositories in a sample shard ship one. A provably permissive subset needs
269
+ external enrichment keyed on `repo_path`.
270
+
271
+ **Opt-out.** Upstream applies opt-out removals in place and re-uploads. This
272
+ dataset was re-filtered by `repo_path` against `d7bc7991ea32`, dropping
273
+ 9,439 units whose repositories had been removed. If you find your code
274
+ here, use the
275
+ [Am I in The Stack?](https://huggingface.co/spaces/bigcode/in-the-stack) opt-out
276
+ process; we re-filter on each upstream patch release.
277
+
278
+ ## Known limitations
279
+
280
+ - **The source corpus repeats file rows inside a repository**: 10.4% of
281
+ repositories and 14.5% of all file rows, byte-identical by `content_id`. This
282
+ dataset deduplicates by (path, content), removing 2,166,221 repeated
283
+ files, and then **drops the 122,886 units that only met their
284
+ gate because of that repetition** (a "set of two manifests" whose two manifests
285
+ were the same file is not a set of two). Counts here are therefore lower than a
286
+ naive extraction would report, and correctly so. Quality counters such as
287
+ `templates`, `tf_files` and `manifests` are recomputed after deduplication, so
288
+ they describe the files actually present.
289
+ - **27.1% of Helm charts cannot render standalone**
290
+ because they call helpers they do not carry. Filter on `self_contained`.
291
+ - **Ansible precision is a floor, not a measurement.** "A list of mappings with
292
+ Ansible-ish keys" also matches ordinary YAML lists, and role variable files are
293
+ indistinguishable from any other mapping by content alone.
294
+ - `manifest_set` groups manifests by directory, which is a convention, not a
295
+ deployment boundary.
296
+ - Stars are as of the crawl and 58-76% of units come from repositories with none.
297
+ Popularity was deliberately not used as a gate; see the card's reasoning above.
298
+
299
+ ## Updates and versioning
300
+
301
+ Upstream applies opt-out removals in place and re-uploads the whole dataset, which
302
+ means the source moves. This dataset therefore records both the revision it was
303
+ extracted from and the revision it was last compliance-filtered against, and both
304
+ appear above. When upstream ships a patch release we re-filter and push a new
305
+ version; the extraction itself is not repeated unless the tooling changes.
306
+
307
+ If you need byte-for-byte reproducibility, pin the dataset revision you loaded.
308
+
309
+ ## Reproducing this dataset
310
+
311
+ Everything here was produced by [helmcode/stack-slice](https://github.com/helmcode/stack-slice):
312
+
313
+ ```bash
314
+ # Survey the corpus for 179 MB of transfer, no download
315
+ python -m stackslice.scan --shards 24
316
+
317
+ # Score the classifier against an independent YAML parser
318
+ python -m stackslice.measure --shards 3
319
+
320
+ # Sweep and extract units (streams shards, stores nothing but output)
321
+ python -m stackslice.extract --shards 8196 --workers 12 --out units
322
+
323
+ # Re-filter for opt-out, deduplicate, add flags
324
+ python -m stackslice.finalize units --out units_final \
325
+ --revision <target-revision> --uuid <shard-uuid>
326
+
327
+ # Convert to parquet, one config per class
328
+ python -m stackslice.publish units_final --out dataset
329
+ ```
330
+
331
+ The full measurement record, including the findings quoted in this card, is in
332
+ [FINDINGS.md](https://github.com/helmcode/stack-slice/blob/main/FINDINGS.md).
333
+
334
+ ## Citation
335
+
336
+ ```bibtex
337
+ @misc{stack_v3_devops,
338
+ title = {The Stack v3 DevOps Corpus},
339
+ author = {Helmcode},
340
+ year = {2026},
341
+ url = {https://huggingface.co/datasets/Helmcode/stack-v3-devops},
342
+ note = {Extracted from The Stack v3 with helmcode/stack-slice}
343
+ }
344
+ ```
345
+
346
+ Please also cite the source corpus, [The Stack v3](https://huggingface.co/datasets/HuggingFaceCode/stack-v3-train).
data/ansible_role/train-00000.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88058e5be4d8e4e55a989f1cc4e01ba10457745503d540a8039b072c52253c93
3
+ size 342410513
data/compose/train-00000.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e63e4a09f55af06562171532458da50181e92f1f0b62e89c36a27ed75bcfb81f
3
+ size 476055982
data/compose/train-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9321eb46202e66bbe818f6405dffd827d1d2bf12da0f0d9adf3b9ca525acaeb0
3
+ size 398882563
data/dockerfile/train-00000.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd96dac01c5302611ff898158d89636ce3eebcb3244c621712d2873214b916ae
3
+ size 475629253
data/dockerfile/train-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25754cc1eadd36cc2ef6e9137bc8fc46d795c0e5804b8316dbc78613f56731fc
3
+ size 475938592
data/dockerfile/train-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:954d16e2ce150d8378f77d7883d8f2095b778c11d09c968e1cb6d1110bc4e864
3
+ size 190482526
data/helm_chart/train-00000.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86558741e1bc369e8d0580d1955e95a997cadf9b871c11e8164632ece9850222
3
+ size 148843306
data/manifest_set/train-00000.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a03d2c961e4dbd0026a006f0773b95f1516768ddd73378d85778d1082c3cf0a
3
+ size 424241706
data/terraform_module/train-00000.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d763249c88cad40fe2bed98110c3f16f6d04cbe4beac25128508bd1ce50a0efb
3
+ size 472628622
data/terraform_module/train-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05d414a0ba6e2acc0e6a98df079e96209844bbf90f4c876dcb886f1f7397892e
3
+ size 474590635
data/terraform_module/train-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0274a85b68b1509ce8050306575ff5d83239f8ce1c8a77c74fb32e2dff643d1
3
+ size 109608501
data/workflow/train-00000.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38d9e2a01d4700b31ae00a148da329fa268e808f260838a81354ffb5c9521eda
3
+ size 475095390
data/workflow/train-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fbdc9e263f3bb96ac1db1e4302cdbd9d646ded85fecc3b9edb9a2591853ba6c3
3
+ size 474722648
data/workflow/train-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2e1a3b7506b8bed182718b9cb262f885a699234f64b5a92252b24bb714dcb3cf
3
+ size 457125103