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

Add validation for Kitfiles #267

Merged
merged 2 commits into from Apr 29, 2024
Merged

Conversation

amisevsk
Copy link
Contributor

@amisevsk amisevsk commented Apr 25, 2024

Description

Add some basic validation to Kitfiles, printing an error if

  • Multiple layers share the same path (makes unpacking/ignoring unclear)
  • Any layer is an absolute path rather than relative
  • Model part's type field is invalid: (max 64 characters, alphanumeric with ., -, and _; must start with alphanumeric)

Testing

You can see all of the failure cases by trying to pack the following Kitfile

Kitfile
manifestVersion: 1.0.0
package:
  name: test-kf
model:
  name: my-model
  path: path1
  parts:
    - name: part1
      path: path1
    - name: part2
      path: /abs/path
    - name: part3
      path: valid-path
      type: test type with space
    - name: part4
      path: also-valid
      type: really-long-but-otherwise-valid-type---this-line-is-65-chars-long
datasets:
  - name: dataset1
    path: path1
  - name: dataset2
    path: path3
  - name: dataset3
    path: /abs/path/2
code:
  - path: path1
  - path: path3
  - path: /abs/path/3

Linked issues

Closes #81

Verify that all modelparts type fields are

* alphanumeric, plus underscores, dashes, and dots
* less than a max length (64)

and return a specific error message in each case.
"kitops/pkg/artifact"
)

const partTypeMaxLen = 64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 64?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arbitrary choice -- big enough that nobody should hit the limit but also not too big since we can increase this without breaking any Kitfiles.

@amisevsk amisevsk merged commit 1331648 into jozu-ai:main Apr 29, 2024
3 checks passed
@amisevsk amisevsk deleted the kitfile-validation branch April 29, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kit pack error
3 participants