1
0
Fork 0

fix(rules): filter gitlab jobs better

list other top-level keys and replace the patternProperties filter
with additionalProperties to prevent top-level keys from being
validated as jobs (which they will fail)
This commit is contained in:
ssube 2019-11-02 11:11:47 -05:00 committed by Sean Sube
parent 842006c34a
commit 988b942fca
1 changed files with 51 additions and 16 deletions

View File

@ -42,8 +42,24 @@ rules:
check: check:
type: object type: object
patternProperties: properties:
"^(?!stages$|\\.)": after_script:
type: array
before_script:
type: array
cache:
type: object
image:
type: string
services:
type: array
stages:
type: array
types:
type: array
variables:
type: object
additionalProperties:
type: object type: object
required: [script] required: [script]
properties: properties:
@ -59,3 +75,22 @@ rules:
type: array type: array
items: items:
type: string type: string
- name: gitlab-top-level
desc: should only have jobs and stages at the top level scope
level: info
tags:
- gitlab
- optional
check:
type: object
not:
anyOf:
- required: [image]
- required: [services]
- required: [types]
- required: [before_script]
- required: [after_script]
- required: [variables]
- required: [cache]