Skip to content

Commit

Permalink
Add back mirror catalog manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
shanedell committed May 17, 2023
1 parent cd3e58f commit 22196ad
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/download/catalogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ import (
"github.com/Shanedell/openshift4-mirror-go/pkg/utils"
)

// this function is mostly to get the catalog source and image content source policy files
func mirrorCatalogManifests(outputDir string, catalog string) error {
cmd := utils.CreateCommand(
filepath.Join(utils.BundleDirs.Bin, utils.OCLocalCmdPath),
"adm",
"catalog",
"mirror",
"--registry-config", filepath.Join(utils.BundleDir, "pull-secret.json"),
"--manifests-only",
"--to-manifests", outputDir,
utils.CatalogIndexes[catalog],
utils.BundleData.TargetRegistry,
)
utils.SetCommandOutput(cmd)

return cmd.Run()
}

func mirrorCatalogs(outputDir string, catalog string) error {
cmd := utils.CreateCommand(
filepath.Join(utils.BundleDirs.Bin, utils.OCLocalCmdPath),
Expand Down Expand Up @@ -46,6 +64,10 @@ func Catalogs() error {

utils.Logger.Infof("Mirroring catalogs for %s from %s", catalog, utils.CatalogIndexes[catalog])

if err := mirrorCatalogManifests(outputDir, catalog); err != nil {
return err
}

if err := mirrorCatalogs(outputDir, catalog); err != nil {
return err
}
Expand Down

0 comments on commit 22196ad

Please sign in to comment.