Skip to content

Commit

Permalink
main: enable containers-storage
Browse files Browse the repository at this point in the history
Enable the ability to use local containers from containers-storage
rather than pulling containers from a remote registry.
  • Loading branch information
kingsleyzissou committed Mar 1, 2024
1 parent e1104c5 commit 0f4a19d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bib/cmd/bootc-image-builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ type ManifestConfig struct {

// TLSVerify specifies whether HTTPS and a valid TLS certificate are required
TLSVerify bool

// Use a local container from the host rather than a repository
Local bool
}

func Manifest(c *ManifestConfig) (*manifest.Manifest, error) {
Expand All @@ -65,6 +68,7 @@ func manifestForDiskImage(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest
Source: c.Imgref,
Name: c.Imgref,
TLSVerify: &c.TLSVerify,
Local: c.Local,
}

var customizations *blueprint.Customizations
Expand Down Expand Up @@ -139,6 +143,7 @@ func manifestForDiskImage(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest
Source: c.Imgref,
Name: c.Imgref,
TLSVerify: &c.TLSVerify,
Local: c.Local,
},
}
_, err = img.InstantiateManifestFromContainers(&mf, containerSources, runner, rng)
Expand All @@ -155,6 +160,7 @@ func manifestForISO(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest, erro
Source: c.Imgref,
Name: c.Imgref,
TLSVerify: &c.TLSVerify,
Local: c.Local,
}

// The ref is not needed and will be removed from the ctor later
Expand Down
3 changes: 3 additions & 0 deletions bib/cmd/bootc-image-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func manifestFromCobra(cmd *cobra.Command, args []string) ([]byte, error) {
rpmCacheRoot, _ := cmd.Flags().GetString("rpmmd")
configFile, _ := cmd.Flags().GetString("config")
tlsVerify, _ := cmd.Flags().GetBool("tls-verify")
localStorage, _ := cmd.Flags().GetBool("local")
imgType, _ := cmd.Flags().GetString("type")
targetArch, _ := cmd.Flags().GetString("target-arch")
if targetArch != "" {
Expand Down Expand Up @@ -215,6 +216,7 @@ func manifestFromCobra(cmd *cobra.Command, args []string) ([]byte, error) {
Repos: repos,
Architecture: buildArch,
TLSVerify: tlsVerify,
Local: localStorage,
}
return makeManifest(manifestConfig, rpmCacheRoot)
}
Expand Down Expand Up @@ -351,6 +353,7 @@ func run() error {
manifestCmd.Flags().String("type", "qcow2", "image type to build [qcow2, ami]")
manifestCmd.Flags().Bool("tls-verify", true, "require HTTPS and verify certificates when contacting registries")
manifestCmd.Flags().String("target-arch", "", "build for the given target architecture (experimental)")
manifestCmd.Flags().Bool("local", false, "use a local container rather than a container from a registry")

logrus.SetLevel(logrus.ErrorLevel)
buildCmd.Flags().AddFlagSet(manifestCmd.Flags())
Expand Down

0 comments on commit 0f4a19d

Please sign in to comment.