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

[REQ] Allow specifying patches as a field on the source definition #393

Open
1 task
cpuguy83 opened this issue Oct 9, 2024 · 2 comments
Open
1 task
Labels
enhancement New feature or request
Milestone

Comments

@cpuguy83
Copy link
Member

cpuguy83 commented Oct 9, 2024

What kind of request is this?

None

What is your request or suggestion?

Today, patches are specified separately from sources, e.g.

sources:
  src0:
    # source def
  patch0:
    # source def

patches:
  src0: # Name of the source to patch
    - source: patch0 # Name of the patch source
      path: path/to/patch # Path inside patch source

I propose we allow adding patches as a nested object on the source, like so:

sources:
  src0:
    # source def
    patches:
      - context: {} # Can be any source type
        path: path/to/patch

Are you willing to submit PRs to contribute to this feature request?

  • Yes, I am willing to implement it.
@cpuguy83 cpuguy83 added the enhancement New feature or request label Oct 9, 2024
@cpuguy83 cpuguy83 added this to the v0.11.0 milestone Oct 9, 2024
@DannyBrito
Copy link
Contributor

would this meaning drop support of main patches section? or support both?

@DannyBrito
Copy link
Contributor

I haven't looked into this yet, but is the following a valid approach?

To support this new syntax while maintaining backwards compatibility, during validation and parsing/filling defaults in the spec, we could convert this new syntax into the current sources block for each of these patches. Additionally, we need to add the required patches block with the corresponding sources. So, given this:

sources:
  src0:
    # source def
    patches:
      - context: {} # Can be any source type
        path: path/to/patch

Behind the scenes, Dalec will convert it to this:

sources:
  src0:
    # source def
  patch0:
    path: path/to/patch
    context: {}

patches:
  src0: # Name of the source to patch
    - source: patch0 # Name of the patch source
      path: path/to/patch # Path inside patch source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants