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

Make task schema updates better #785

Open
decleaver opened this issue Jul 12, 2024 · 0 comments
Open

Make task schema updates better #785

decleaver opened this issue Jul 12, 2024 · 0 comments

Comments

@decleaver
Copy link
Collaborator

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant