Skip to content

automate compose-spec schema updates #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
uses: golangci/golangci-lint-action@v2
- name: Check license
run: DOCKER_BUILDKIT=1 make check-license
- name: Check schema
run: make check-schema

test:
strategy:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Sync compose-spec

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

jobs:
schema:
name: Update Schema
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/[email protected]

- name: Download schema
run: curl -fSL -o schema/compose-spec.json https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json

- name: Show diff
run: git diff schema/compose-spec.json

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
title: Update compose-spec.json
commit-message: Update compose-spec.json
signoff: true
branch: compose-spec
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ lint: build-validate-image
check-license: build-validate-image
docker run --rm $(IMAGE_PREFIX)validate bash -c "./scripts/validate/fileheader"

.PHONY: check-schema
check-schema:
curl -fSL -o schema/compose-spec.json https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json
git diff --exit-code schema/compose-spec.json

.PHONY: setup
setup: ## Setup the precommit hook
@which pre-commit > /dev/null 2>&1 || (echo "pre-commit not installed see README." && false)
Expand Down
13 changes: 7 additions & 6 deletions schema/compose-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
},
"cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"cgroup": {"type": "string", "enum": ["host", "private"]},
"cgroup_parent": {"type": "string"},
"command": {
"oneOf": [
Expand Down Expand Up @@ -581,12 +582,12 @@
"items": {
"type": "object",
"properties": {
"capabilities": {"$ref": "#/definitions/list_of_strings"},
"count": {"type": ["string", "integer"]},
"device_ids": {"$ref": "#/definitions/list_of_strings"},
"driver":{"type": "string"},
"options":{"$ref": "#/definitions/list_or_dict"}
},
"capabilities": {"$ref": "#/definitions/list_of_strings"},
"count": {"type": ["string", "integer"]},
"device_ids": {"$ref": "#/definitions/list_of_strings"},
"driver":{"type": "string"},
"options":{"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false,
"patternProperties": {"^x-": {}}
}
Expand Down