defenseunicorns / defenseunicorns/uds-cli
Make task schema updates better
- Dominant language
- Go
- Stars
- 54
- Forks
- 21
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 45
Description
### Describe what should be investigated or refactored
Goal:
We want to provide uds-cli users with the tasks.schema.json file which comes from maru-runner
Problem:
Currently when we generate `tasks.schema.json` we are running the same script code that maru-runner is using to generate their `tasks.schema.json` file, if they were to make any updates to their scripts we would need to do the same.
```
# Create the json schema for tasks.yaml
go run main.go internal config-tasks-schema > tasks.schema.json
# Adds pattern properties to all definitions to allow for yaml extensions
jq '
def addPatternProperties:
. +
if has("properties") then
{"patternProperties": {"^x-": {}}}
else
{}
end;
walk(if type == "object" then addPatternProperties else . end)
' tasks.schema.json > temp_tasks.schema.json
mv temp_tasks.schema.json tasks.schema.json
awk '{gsub(/\[github\.com\/defenseunicorns\/maru-runner\/src\/pkg\/variables\.ExtraVariableInfo\]/, ""); print}' tasks.schema.json > temp_tasks.schema.json
mv temp_tasks.schema.json tasks.schema.json
```
Potential solutions:
- add maru runner command so that we can just call maru-runner code to generate the schema, without having to duplicate script code.
- just copy over the schema file from their repo (ie. workflow job)
Contributor guide
Assessment
This issue has not been assessed yet.