-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 kustomize build {repoUrl} #260
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Liujingfang1 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Following examples all work
In order to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple of quick questions
pkg/loader/fileloader.go
Outdated
@@ -53,6 +53,9 @@ func (l *fileLoader) Root() string { | |||
// Example: "/home/seans/project" or "/home/seans/project/" | |||
// NOT "/home/seans/project/file.yaml". | |||
func (l *fileLoader) New(newRoot string) (Loader, error) { | |||
if isRepoUrl(newRoot) { | |||
return newGithubLoader(newRoot, l.fSys) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NewLoader does this (it doesn't look right here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is slight difference between New
and NewLoader
. New
creates a new fileLoader whose root is a relative path in current fileloader. NewLoader
is more like creating a root loader, where we don't have an existing fileloader.
pkg/loader/githubloader.go
Outdated
repo string | ||
checkoutDir string | ||
fSys fs.FileSystem | ||
loader *fileLoader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this just mixin fileLoader (and use its fSys field)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can.
go vet and metalinter should ignore the vendored stuff (else everything would already be blowing up). So all the deps come in because they have an s3 getter that comes along for the ride (no option to just get a subset of the getters). I guess we can just vendor the world for now, rather than hack around it. Perhaps file an issue with hashicorp and move on. |
That's corret. The go-getter client contains several detectors for different kinds of repos(github, mecurial and so on), s3 is one of them. There is no option to get a subset of it.
I created a PR #262 on a different branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
} | ||
|
||
// isRepoUrl checks if a string is a repo Url | ||
func isRepoUrl(s string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add test coverage for this
githubLoader
which checks out a repo, saves to a temp dir and creates afileLoader
with root at the temp dirNewLoader
function to return either afileLoader
orgithubLoader
based on the input stringNewLoader
in bothbuild
anddiff
fileLoader.New
, if the input string is a repoUrl, return agithubLoader
.The accepted format of the repoUrl is
github.com/project/repo//subdir?ref=xxx
both
subdir
andref
are optional.