Skip to content
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

Add vendoring of cloudbuild schema #339

Merged
merged 3 commits into from
Nov 24, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@
)$
types_or: [json,yaml]

# this hook is autogenerated from a script
# to modify this hook, update `src/check_jsonschema/catalog.py`
# and run `make generate-hooks` or `tox run -e generate-hooks-config`
- id: check-cloudbuild
name: Validate Google Cloud Build config
description: 'Validate Google Cloud Build config against the schema provided by SchemaStore'
entry: check-jsonschema --builtin-schema vendor.cloudbuild
language: python
files: ^cloudbuild\.(yml|yaml)$
types: [yaml]

# this hook is autogenerated from a script
# to modify this hook, update `src/check_jsonschema/catalog.py`
# and run `make generate-hooks` or `tox run -e generate-hooks-config`
Expand Down
14 changes: 14 additions & 0 deletions docs/precommit_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ Validate Buildkite Pipelines against the schema provided by Buildkite
- id: check-buildkite


``check-cloudbuild``
~~~~~~~~~~~~~~~~~~~~

Validate Google Cloud Build config against the schema provided by SchemaStore

.. code-block:: yaml
:caption: example config

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.1
hooks:
- id: check-cloudbuild


``check-dependabot``
~~~~~~~~~~~~~~~~~~~~

Expand Down
1 change: 1 addition & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ SchemaStore and other sources:
- ``vendor.bamboo-spec``
- ``vendor.bitbucket-pipelines``
- ``vendor.buildkite``
- ``vendor.cloudbuild``
- ``vendor.dependabot``
- ``vendor.drone-ci``
- ``vendor.github-actions``
Expand Down
410 changes: 410 additions & 0 deletions src/check_jsonschema/builtin_schemas/vendor/cloudbuild.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a1586617a33ebdaaec163d224a3a09ff010e5ed9ecccdd7d954715f2ad6e361e
8 changes: 8 additions & 0 deletions src/check_jsonschema/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ def _githubusercontent_url(owner: str, repo: str, ref: str, path: str) -> str:
"types_or": ["json", "yaml"],
},
},
"cloudbuild": {
"url": "https://json.schemastore.org/cloudbuild.json",
"hook_config": {
"name": "Validate Google Cloud Build config",
"files": r"^cloudbuild\.(yml|yaml)$",
"types": "yaml",
},
},
"dependabot": {
"url": "https://json.schemastore.org/dependabot-2.0.json",
"hook_config": {
Expand Down
2 changes: 2 additions & 0 deletions tests/example-files/hooks/negative/cloudbuild/empty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# empty
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
steps:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: "/bin/bash"
args: ['-c', '"echo hello"']