Skip to content

Commit f6fa43f

Browse files
committed
fix(appr): use given cache dir for image builds
1 parent 768dcf1 commit f6fa43f

File tree

6 files changed

+409
-16
lines changed

6 files changed

+409
-16
lines changed

pkg/apprclient/apprclientfakes/fake_client.go

Lines changed: 273 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apprclient/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . Client
12
package apprclient
23

34
import (

pkg/appregistry/builder.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 builder.go ImageAppender
12
package appregistry
23

34
import (
@@ -46,6 +47,7 @@ type AppregistryImageBuilder struct {
4647
CleanOutput bool
4748
ManifestDir string
4849
DatabaseDir string
50+
client apprclient.Client
4951
}
5052

5153
func NewAppregistryImageBuilder(options ...AppregistryBuildOption) (*AppregistryImageBuilder, error) {
@@ -69,14 +71,11 @@ func NewAppregistryImageBuilder(options ...AppregistryBuildOption) (*Appregistry
6971
CleanOutput: config.CleanOutput,
7072
ManifestDir: config.ManifestDir,
7173
DatabaseDir: config.DatabaseDir,
74+
client: config.Client,
7275
}, nil
7376
}
7477

7578
func (b *AppregistryImageBuilder) Build() error {
76-
opts := apprclient.Options{Source: b.AppRegistryEndpoint}
77-
if b.AuthToken != "" {
78-
opts.AuthToken = b.AuthToken
79-
}
8079

8180
defer func() {
8281
if !b.CleanOutput {
@@ -87,12 +86,7 @@ func (b *AppregistryImageBuilder) Build() error {
8786
}
8887
}()
8988

90-
client, err := apprclient.New(opts)
91-
if err != nil {
92-
return err
93-
}
94-
95-
downloader := NewManifestDownloader(client)
89+
downloader := NewManifestDownloader(b.client)
9690
if err := downloader.DownloadManifests(b.ManifestDir, b.AppRegistryOrg); err != nil {
9791
return err
9892
}

0 commit comments

Comments
 (0)