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

Source Refactor #117

Merged
merged 9 commits into from
Feb 27, 2024
Merged

Source Refactor #117

merged 9 commits into from
Feb 27, 2024

Conversation

adamperlin
Copy link
Contributor

Refactors the source generation code in sources.go. In particular:

  • Moves the logic for generating each source's LLB to a separate function for each source variant
  • Changes source filtering logic to make filtering parameters as explicit as possible for each source
  • Attempts to push source mounting logic to the caller as much as possible by allowing the caller to pass in a custom callback which wraps the source filtering function

Note: This could probably wait for #110, as those unit tests would probably be better able to catch any bugs in the filter handling logic introduced here.

test/source_test.go Outdated Show resolved Hide resolved
@adamperlin adamperlin force-pushed the adamperlin/source-refactor branch from 9b83cd0 to d600d45 Compare February 14, 2024 19:57
source.go Outdated Show resolved Hide resolved
source.go Outdated Show resolved Hide resolved
source.go Outdated Show resolved Hide resolved
source.go Outdated Show resolved Hide resolved
source.go Show resolved Hide resolved
@adamperlin adamperlin requested a review from a team as a code owner February 26, 2024 21:06
source.go Outdated Show resolved Hide resolved
source.go Outdated
return src.DockerImage != nil && src.DockerImage.Cmd != nil
}

func GetFilter(src Source, forMount bool, opts ...llb.ConstraintsOpt) llb.StateOption {
Copy link
Member

Choose a reason for hiding this comment

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

This should be uneported, and maybe inlined in GetSource?

Copy link
Contributor Author

@adamperlin adamperlin Feb 27, 2024

Choose a reason for hiding this comment

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

I'd rather not inline it to avoid passing forMount through getSource, if that's ok

source.go Outdated Show resolved Hide resolved
source_test.go Outdated Show resolved Hide resolved
@cpuguy83
Copy link
Member

This says there's conflicts.

@cpuguy83
Copy link
Member

It doesn't state the conflicts which is super weird.

image

@sozercan sozercan merged commit 4fe9f4b into Azure:main Feb 27, 2024
9 checks passed
@adamperlin adamperlin deleted the adamperlin/source-refactor branch February 28, 2024 16:10
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.

3 participants