[RAPTOR-18973] feat(workload): manifest package core: parse, locate, compile - #745
Draft
wojtekwdr wants to merge 1 commit into
Draft
[RAPTOR-18973] feat(workload): manifest package core: parse, locate, compile#745wojtekwdr wants to merge 1 commit into
wojtekwdr wants to merge 1 commit into
Conversation
|
🎫 Jira: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RATIONALE
dr workload updeploys from one committed file:.datarobot.yamlat the repository root, the exact specdr workload create --spec-fileaccepts today plus two CLI-managed conveniences. This PR adds the package that owns that file. It is the remaining blocker for theconfigwizard (RAPTOR-18975) and theupcore (RAPTOR-18976). No command surface changes; nothing user-visible ships.There are deliberately no typed spec structs: the workload-api schema moves faster than any struct would, so unknown blocks pass through untouched and platform additions need no CLI release. The file parses once into a yaml.Node tree and everything derives from it, which is what makes line-anchored errors and comment-preserving writes possible.
This is the first of two stacked PRs for the ticket, split to keep each at about 1k lines: this one carries the read path (parse, locate, compile); the stacked follow-up carries the validation ledger and the workloadId write-back. Part of RAPTOR-18973.
CHANGES
New package
internal/workload/manifest; no existing files are touched.Parse and locate (
manifest.go,node.go,keys.go)Load/Parse: one YAML parse; JSON content parses too, since the manifest is whatever the create endpoint accepts and YAML is a superset of JSON. Empty, comment-only, non-mapping and foreign files (none of the recognized top-level keys present) are rejected rather than deployed as an all-defaults workload.Locatesearches upward from the working directory the way git finds its repository root, stopping after the home directory or the filesystem root.ErrNotFoundiserrors.Is-able soupcan fall into the wizard instead of failing.WorkloadID()andName()accessors for the two fields the CLI itself reads.node.goholds the nil-safe yaml.Node accessors the whole package chains lookups with;keys.gonames the manifest-level fields once.Error types (
errors.go)FieldErrorcarries the YAML path and manifest line of one finding;ValidationErrorcollects every finding for a file in one pass. Compile uses them for credential syntax errors now; the stacked ledger PR reports through the same types.Compile (
compile.go)Compilelowers the tree to the JSON create payload: stripsworkloadId, expands thedr-credential:<credential-id>/<key>value shorthand into the API's credential-backed object form (the object form is accepted in the file as well), and passes unknown blocks through untouched. The environmentVars walk is shape-agnostic, so the shorthand works wherever the spec puts variables. A malformed shorthand is refused rather than sent to the API as a literal value.CredentialRefsso callers can verify each referenced credential with a GET before anything mutates; the credential lookup client lands with RAPTOR-18977.Tests
Locatewalk semantics (ancestor hit, not-found, a directory named.datarobot.yamlskipped), shorthand expansion locked againstworkload.EnvironmentVar's JSON tags so a drifted field name fails in CI instead of at the API, unknown-key passthrough, and the compiled payload asserted to be validworkload.ValidateWorkloadCreateRequestinput (the down-payment on the end-to-end smoke property in RAPTOR-18971).NOTES
Stacked follow-up (same ticket): the validation ledger (
Validatewith the full line-anchored rule set) andWriteWorkloadID(the comment-preserving write-back). Deferred beyond that, as the ticket allows: the ancestor-manifest warning (RAPTOR-18975 builds it onLocate), the full-file write for the wizard (RAPTOR-18975), and the credential lookup client (RAPTOR-18977).PR Automation
Comment-Commands: Trigger CI by commenting on the PR:
/trigger-smoke-testor/trigger-test-smoke- Run smoke tests/trigger-install-testor/trigger-test-install- Run installation testsLabels: Apply labels to trigger workflows:
run-smoke-testsorgo- Run smoke tests on demand (only works for non-forked PRs)Important
For Forked PRs: The
run-smoke-testslabel won't work. A required Smoke Tests check will block merge until a maintainer acts:/approve-smoke-teststo run smoke tests (results will set the check)/skip-smoke-teststo bypass the check without running testsPlease comment requesting a maintainer review if you need smoke tests to run.