Skip to content

Commit 67e3113

Browse files
committed
automate compose-spec schema updates
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 5c348e3 commit 67e3113

File tree

4 files changed

+43
-6
lines changed

4 files changed

+43
-6
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
uses: golangci/golangci-lint-action@v2
1717
- name: Check license
1818
run: DOCKER_BUILDKIT=1 make check-license
19+
- name: Check schema
20+
run: DOCKER_BUILDKIT=1 make check-schema
1921

2022
test:
2123
strategy:

.github/workflows/sync.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Sync compose-spec
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * *"
7+
8+
jobs:
9+
schema:
10+
name: Update Schema
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/[email protected]
16+
17+
- name: Download schema
18+
run: curl -fSL -o schema/compose-spec.json https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json
19+
20+
- name: Show diff
21+
run: git diff schema/compose-spec.json
22+
23+
- name: Create Pull Request
24+
uses: peter-evans/create-pull-request@v4
25+
with:
26+
title: Update compose-spec.json
27+
commit-message: Update compose-spec.json
28+
signoff: true
29+
branch: compose-spec

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ lint: build-validate-image
3838
check-license: build-validate-image
3939
docker run --rm $(IMAGE_PREFIX)validate bash -c "./scripts/validate/fileheader"
4040

41+
.PHONY: check-schema
42+
check-schema:
43+
curl -fSL -o schema/compose-spec.json https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json
44+
git diff --exit-code schema/compose-spec.json
45+
4146
.PHONY: setup
4247
setup: ## Setup the precommit hook
4348
@which pre-commit > /dev/null 2>&1 || (echo "pre-commit not installed see README." && false)

schema/compose-spec.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
},
142142
"cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
143143
"cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
144+
"cgroup": {"type": "string", "enum": ["host", "private"]},
144145
"cgroup_parent": {"type": "string"},
145146
"command": {
146147
"oneOf": [
@@ -581,12 +582,12 @@
581582
"items": {
582583
"type": "object",
583584
"properties": {
584-
"capabilities": {"$ref": "#/definitions/list_of_strings"},
585-
"count": {"type": ["string", "integer"]},
586-
"device_ids": {"$ref": "#/definitions/list_of_strings"},
587-
"driver":{"type": "string"},
588-
"options":{"$ref": "#/definitions/list_or_dict"}
589-
},
585+
"capabilities": {"$ref": "#/definitions/list_of_strings"},
586+
"count": {"type": ["string", "integer"]},
587+
"device_ids": {"$ref": "#/definitions/list_of_strings"},
588+
"driver":{"type": "string"},
589+
"options":{"$ref": "#/definitions/list_or_dict"}
590+
},
590591
"additionalProperties": false,
591592
"patternProperties": {"^x-": {}}
592593
}

0 commit comments

Comments
 (0)