Repository navigation
Conversation
| const isTemplate = isRecord(json) && METADATA_KEY in json; | ||
| const variant = variantMode === 'auto' ? (isTemplate ? 'template' : 'strict') : variantMode; |
There was a problem hiding this comment.
If somebody just copies a valid yaml from /examples to the template directory /library/workflows, without adding the template-metradata, the validation should fail.
The auto should not choose the variant based on the shape of the file, but on the location of the file.
There was a problem hiding this comment.
The script was copied over from kibana without changes. The idea is to not make it drift too much from there so we have almost aligned implementations.
I think the CI responsibility would be to decide to which folder to point each variant of the script, without hardcoding it at the script level. That gives us more flexibility also for users who wants to use this script locally to check other scripts.
There was a problem hiding this comment.
Okay, that makes sense.
Then I think we should also add scoped options using the target directories in the package.json scripts:
"validate": "node scripts/validate-workflows.mjs",
"validate:templates": "node run validate library/workflows --recursive --variant template",
"validate:examples": "node run validate examples --recursive --variant strict",
"validate:all": "node run validate:templates & node run validate:examples",
(handwritten, not tested)
In the pipeline:
npm run validate:templates --schema "${WORKFLOWS_SCHEMA}"
npm run validate:examples --schema "${WORKFLOWS_SCHEMA}"What do you think?
There was a problem hiding this comment.
sure, I'll add it to the PR
| } | ||
| }; | ||
|
|
||
| export const discoverFiles = (target, { recursive = false } = {}) => { |
There was a problem hiding this comment.
How do we prevent an arbitrary config YAML from breaking the validation process?
If the target is root, I don't think we should assume every yaml file in the repo is a workflow. We could have arbitrary yamls in the repo (configs, partial workflow yamls, the "template of templates") that should not be validated.
Would it be possible to scope the validation to just 2 directories
/examples: using always variant 'strict'/library/workflows: using always variant 'template'
|
@dej611 Thanks for this, Wiring it into This isn't something we can just toggle on. Per eng-prod (elastic/ci#290), enabling fork builds means Buildkite uploads the pipeline definition from the fork and runs it on our agents with brokered Vault secrets, plus the DoS surface on a public repo — their conclusion is "we should avoid this for public repos", and they've told us it will not be permitted on public repos. We already encoded that in So the plan of record is already that PR validation lives in GitHub Actions, and Buildkite stays for the credentialed publish on Concretely, what I think we should do instead:
Happy to push the Actions workflow onto this branch if that's easier — the rest of the PR is good to go as far as I'm concerned. |
|
@copilot resolve the merge conflicts in this pull request |
# Conflicts: # package-lock.json # package.json Co-authored-by: talboren <68807791+talboren@users.noreply.github.com>
Co-authored-by: talboren <68807791+talboren@users.noreply.github.com>
Resolved by merging |
|
@copilot resolve the merge conflicts in this pull request |
# Conflicts: # package-lock.json # package.json Co-authored-by: talboren <68807791+talboren@users.noreply.github.com>
Resolved by merging the latest |
|
@copilot resolve the merge conflicts in this pull request |
# Conflicts: # package-lock.json # package.json Co-authored-by: dej611 <924948+dej611@users.noreply.github.com>
Resolved by merging the latest |
This PR contains most of the logic within the elastic/kibana#281827 Kibana counter part.
The idea is to have a lightweight version of it, so things like DAG consistency has been removed to avoid to have 2K LoC moved over for a single check for now.
The new script gets as input a JSON schema via either a CDN url or a file path. If none are provided then it fails gracefully skipping it.
Example of execution: