Skip to content

Commit

Permalink
feat(build): new option --container-registry-mirror /2
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
  • Loading branch information
ilya-lesikov committed May 31, 2024
1 parent a6b8164 commit 7ca23aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion cmd/werf/bundle/download/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func NewCmd(ctx context.Context) *cobra.Command {
common.SetupInsecureRegistry(&commonCmdData, cmd)
common.SetupInsecureHelmDependencies(&commonCmdData, cmd, false)
common.SetupSkipTlsVerifyRegistry(&commonCmdData, cmd)
common.SetupContainerRegistryMirror(&commonCmdData, cmd)

common.SetupRepoOptions(&commonCmdData, cmd, common.RepoDataOptions{})

Expand All @@ -92,7 +93,12 @@ func runDownload(ctx context.Context) error {
return fmt.Errorf("initialization error: %w", err)
}

if err := common.DockerRegistryInit(ctx, &commonCmdData); err != nil {
registryMirrors, err := common.GetContainerRegistryMirror(ctx, &commonCmdData)
if err != nil {
return fmt.Errorf("get container registry mirrors: %w", err)
}

if err := common.DockerRegistryInit(ctx, &commonCmdData, registryMirrors); err != nil {
return err
}

Expand Down
10 changes: 8 additions & 2 deletions cmd/werf/bundle/export/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func NewCmd(ctx context.Context) *cobra.Command {
common.SetupInsecureRegistry(&commonCmdData, cmd)
common.SetupInsecureHelmDependencies(&commonCmdData, cmd, true)
common.SetupSkipTlsVerifyRegistry(&commonCmdData, cmd)
common.SetupContainerRegistryMirror(&commonCmdData, cmd)

common.SetupLogOptions(&commonCmdData, cmd)
common.SetupLogProjectDir(&commonCmdData, cmd)
Expand Down Expand Up @@ -160,7 +161,12 @@ func runExport(ctx context.Context, imagesToProcess build.ImagesToProcess) error
return fmt.Errorf("initialization error: %w", err)
}

containerBackend, processCtx, err := common.InitProcessContainerBackend(ctx, &commonCmdData)
registryMirrors, err := common.GetContainerRegistryMirror(ctx, &commonCmdData)
if err != nil {
return fmt.Errorf("get container registry mirrors: %w", err)
}

containerBackend, processCtx, err := common.InitProcessContainerBackend(ctx, &commonCmdData, registryMirrors)
if err != nil {
return err
}
Expand All @@ -187,7 +193,7 @@ func runExport(ctx context.Context, imagesToProcess build.ImagesToProcess) error
return err
}

if err := common.DockerRegistryInit(ctx, &commonCmdData); err != nil {
if err := common.DockerRegistryInit(ctx, &commonCmdData, registryMirrors); err != nil {
return err
}

Expand Down

0 comments on commit 7ca23aa

Please sign in to comment.