Skip to content

Commit

Permalink
add ability to recursively pull bundles (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewrenn8 authored May 27, 2021
1 parent 972cb48 commit d7d1070
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
export PATH=/tmp/bin:$PATH
# imgpkg
wget -O- https://github.com/k14s/imgpkg/releases/download/v0.3.0/imgpkg-linux-amd64 > /tmp/bin/imgpkg && \
echo "7ebd513bdb4d448764725202f0bfe41e052a594eddeb55e53681ebdf4c27d4dc /tmp/bin/imgpkg" | shasum -c - && \
wget -O- https://github.com/k14s/imgpkg/releases/download/v0.7.0/imgpkg-linux-amd64 > /tmp/bin/imgpkg && \
echo "bb90881c2c03cad4d50b2f0881d1330d341a37bb55bd8fff50bf228f7cfcf3d2 /tmp/bin/imgpkg" | shasum -c - && \
chmod +x /tmp/bin/imgpkg
# helm 2
Expand Down
3 changes: 3 additions & 0 deletions examples/imgpkgBundle/vendir.lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ directories:
- imgpkgBundle:
image: index.docker.io/ewrenn/consul-helm-bundle@sha256:15777f0007ee10fb9b2e0ed55107751188f3f3a11bae81c122ff4f11c9d67d15
path: docker.io/ewrenn/consul-helm-by-digest
- imgpkgBundle:
image: index.docker.io/k8slt/vendir-test-recursive-bundle@sha256:4d58d662d3f6e858fb3f989214482405ac13974d98f3f0695bd36e3fc36d3f81
path: docker.io/k8slt/vendir-test-recursive-bundle
path: vendor
kind: LockConfig
5 changes: 5 additions & 0 deletions examples/imgpkgBundle/vendir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ directories:
image: index.docker.io/ewrenn/consul-helm-bundle@sha256:15777f0007ee10fb9b2e0ed55107751188f3f3a11bae81c122ff4f11c9d67d15
excludePaths:
- .git/**/*

- path: docker.io/k8slt/vendir-test-recursive-bundle
imgpkgBundle:
image: index.docker.io/k8slt/vendir-test-recursive-bundle@sha256:4d58d662d3f6e858fb3f989214482405ac13974d98f3f0695bd36e3fc36d3f81
recursive: true

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/vendir/config/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ type DirectoryContentsImgpkgBundle struct {
SecretRef *DirectoryContentsLocalRef `json:"secretRef,omitempty"`

DangerousSkipTLSVerify bool `json:"dangerousSkipTLSVerify,omitempty"`
Recursive bool `json:"recursive,omitempty"`
}

type DirectoryContentsGithubRelease struct {
Expand Down
8 changes: 8 additions & 0 deletions pkg/vendir/fetch/imgpkgbundle/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func (t *Sync) Sync(dstPath string) (ctlconf.LockDirectoryContentsImgpkgBundle,
}

args = t.addDangerousArgs(args)
args = t.addGeneralArgs(args)

var stdoutBs, stderrBs bytes.Buffer

Expand Down Expand Up @@ -111,3 +112,10 @@ func (t *Sync) addDangerousArgs(args []string) []string {
}
return args
}

func (t *Sync) addGeneralArgs(args []string) []string {
if t.opts.Recursive {
args = append(args, "--recursive")
}
return args
}

0 comments on commit d7d1070

Please sign in to comment.