mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-17 09:49:13 +00:00
@@ -16,6 +16,17 @@ test 3 == \
|
|||||||
echo $?
|
echo $?
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Overlays can be remote as well:
|
||||||
|
|
||||||
|
<!-- @remoteOverlayBuild @test -->
|
||||||
|
|
||||||
|
```
|
||||||
|
target=github.com/kubernetes-sigs/kustomize//examples/multibases/dev/?ref=v1.0.6
|
||||||
|
test 1 == \
|
||||||
|
$(kustomize build $target | grep cluster-a-dev-myapp-pod | wc -l); \
|
||||||
|
echo $?
|
||||||
|
```
|
||||||
|
|
||||||
A base can also be specified as a URL:
|
A base can also be specified as a URL:
|
||||||
|
|
||||||
<!-- @createOverlay @test -->
|
<!-- @createOverlay @test -->
|
||||||
@@ -55,4 +66,4 @@ Here are some example urls pointing to Github repos following this convention.
|
|||||||
`github.com/Liujingfang1/kustomize//examples/helloWorld?ref=repoUrl2`
|
`github.com/Liujingfang1/kustomize//examples/helloWorld?ref=repoUrl2`
|
||||||
- a subdirectory in a repo on commit `7050a45134e9848fca214ad7e7007e96e5042c03`
|
- a subdirectory in a repo on commit `7050a45134e9848fca214ad7e7007e96e5042c03`
|
||||||
|
|
||||||
`github.com/Liujingfang1/kustomize//examples/helloWorld?ref=7050a45134e9848fca214ad7e7007e96e5042c03`
|
`github.com/Liujingfang1/kustomize//examples/helloWorld?ref=7050a45134e9848fca214ad7e7007e96e5042c03`
|
||||||
|
|||||||
@@ -29,14 +29,17 @@ import (
|
|||||||
|
|
||||||
// githubLoader loads files from a checkout github repo
|
// githubLoader loads files from a checkout github repo
|
||||||
type githubLoader struct {
|
type githubLoader struct {
|
||||||
repo string
|
repo string
|
||||||
|
// target is the directory which is to be built
|
||||||
|
targetDir string
|
||||||
|
// checkoutDir is for the whole repository
|
||||||
checkoutDir string
|
checkoutDir string
|
||||||
loader *fileLoader
|
loader *fileLoader
|
||||||
}
|
}
|
||||||
|
|
||||||
// Root returns the root location for this Loader.
|
// Root returns the root location for this Loader.
|
||||||
func (l *githubLoader) Root() string {
|
func (l *githubLoader) Root() string {
|
||||||
return l.checkoutDir
|
return l.targetDir
|
||||||
}
|
}
|
||||||
|
|
||||||
// New delegates to fileLoader.New
|
// New delegates to fileLoader.New
|
||||||
@@ -60,15 +63,18 @@ func newGithubLoader(repoUrl string, fs fs.FileSystem) (*githubLoader, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
target := filepath.Join(dir, "repo")
|
repodir := filepath.Join(dir, "repo")
|
||||||
err = checkout(repoUrl, target)
|
src, subdir := getter.SourceDirSubdir(repoUrl)
|
||||||
|
err = checkout(src, repodir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
target := filepath.Join(repodir, subdir)
|
||||||
l := newFileLoaderAtRoot(target, fs)
|
l := newFileLoaderAtRoot(target, fs)
|
||||||
return &githubLoader{
|
return &githubLoader{
|
||||||
repo: repoUrl,
|
repo: repoUrl,
|
||||||
checkoutDir: dir,
|
targetDir: target,
|
||||||
|
checkoutDir: repodir,
|
||||||
loader: l,
|
loader: l,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user