Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions contrib/completions/bash/oc

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

6 changes: 6 additions & 0 deletions contrib/completions/zsh/oc

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

3 changes: 3 additions & 0 deletions pkg/oc/cli/admin/release/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func NewExtract(f kcmdutil.Factory, parentName string, streams genericclioptions
flags := cmd.Flags()
flags.StringVarP(&o.RegistryConfig, "registry-config", "a", o.RegistryConfig, "Path to your registry credentials (defaults to ~/.docker/config.json)")
flags.StringVar(&o.GitExtractDir, "git", o.GitExtractDir, "Check out the sources that created this release into the provided dir. Repos will be created at <dir>/<host>/<path>. Requires 'git' on your path.")
flags.BoolVar(&o.Insecure, "insecure", o.Insecure, "Allow pull operations from registries to be made over HTTP.")
flags.StringVar(&o.From, "from", o.From, "Image containing the release payload.")
flags.StringVar(&o.File, "file", o.File, "Extract a single file from the payload to standard output.")
flags.StringVar(&o.Directory, "to", o.Directory, "Directory to write release contents to, defaults to the current directory.")
Expand All @@ -77,6 +78,7 @@ type ExtractOptions struct {
File string

RegistryConfig string
Insecure bool

ImageMetadataCallback func(m *extract.Mapping, dgst digest.Digest, config *docker10.DockerImageConfig)
}
Expand Down Expand Up @@ -141,6 +143,7 @@ func (o *ExtractOptions) Run() error {
}
opts := extract.NewOptions(genericclioptions.IOStreams{Out: o.Out, ErrOut: o.ErrOut})
opts.RegistryConfig = o.RegistryConfig
opts.Insecure = o.Insecure

switch {
case len(o.File) > 0:
Expand Down
4 changes: 4 additions & 0 deletions pkg/oc/cli/admin/release/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func NewMirror(f kcmdutil.Factory, parentName string, streams genericclioptions.
flags.StringVar(&o.From, "from", o.From, "Image containing the release payload.")
flags.StringVar(&o.To, "to", o.To, "An image repository to push to.")
flags.BoolVar(&o.DryRun, "dry-run", o.DryRun, "Display information about the mirror without actually executing it.")
flags.BoolVar(&o.Insecure, "insecure", o.Insecure, "Allow push and pull operations to registries to be made over HTTP.")

flags.BoolVar(&o.SkipRelease, "skip-release-image", o.SkipRelease, "Do not push the release image.")
flags.StringVar(&o.ToRelease, "to-release-image", o.ToRelease, "Specify an alternate locations for the release image instead as tag 'release' in --to")
Expand All @@ -85,6 +86,7 @@ type MirrorOptions struct {

RegistryConfig string
DryRun bool
Insecure bool

ImageStream *imageapi.ImageStream
TargetFn func(component string) imagereference.DockerImageReference
Expand Down Expand Up @@ -161,6 +163,7 @@ func (o *MirrorOptions) Run() error {
extractOpts := NewExtractOptions(genericclioptions.IOStreams{Out: buf, ErrOut: o.ErrOut})
extractOpts.RegistryConfig = o.RegistryConfig
extractOpts.ImageMetadataCallback = func(m *extract.Mapping, dgst digest.Digest, config *docker10.DockerImageConfig) {}
extractOpts.Insecure = o.Insecure
extractOpts.From = o.From
extractOpts.File = "image-references"
if err := extractOpts.Run(); err != nil {
Expand Down Expand Up @@ -237,6 +240,7 @@ func (o *MirrorOptions) Run() error {
opts.RegistryConfig = o.RegistryConfig
opts.Mappings = mappings
opts.DryRun = o.DryRun
opts.Insecure = o.Insecure
opts.ManifestUpdateCallback = func(registry string, manifests map[digest.Digest]digest.Digest) error {
lock.Lock()
defer lock.Unlock()
Expand Down
11 changes: 9 additions & 2 deletions pkg/oc/cli/admin/release/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func NewRelease(f kcmdutil.Factory, parentName string, streams genericclioptions

// destination
flags.BoolVar(&o.DryRun, "dry-run", o.DryRun, "Skips changes to external registries via mirroring or pushing images.")
flags.BoolVar(&o.Insecure, "insecure", o.Insecure, "Allow push and pull operations to registries to be made over HTTP.")
flags.StringVar(&o.Mirror, "mirror", o.Mirror, "Mirror the contents of the release to this repository.")
flags.StringVar(&o.ToDir, "to-dir", o.ToDir, "Output the release manifests to a directory instead of creating an image.")
flags.StringVar(&o.ToFile, "to-file", o.ToFile, "Output the release to a tar file instead of creating an image.")
Expand Down Expand Up @@ -164,7 +165,8 @@ type NewOptions struct {
ReleaseMetadata string
PreviousVersions []string

DryRun bool
DryRun bool
Insecure bool

ToFile string
ToDir string
Expand Down Expand Up @@ -352,6 +354,7 @@ func (o *NewOptions) Run() error {
buf := &bytes.Buffer{}
extractOpts := extract.NewOptions(genericclioptions.IOStreams{Out: buf, ErrOut: o.ErrOut})
extractOpts.RegistryConfig = o.RegistryConfig
extractOpts.Insecure = o.Insecure
extractOpts.OnlyFiles = true
extractOpts.Mappings = []extract.Mapping{
{
Expand Down Expand Up @@ -759,6 +762,7 @@ func (o *NewOptions) extractManifests(is *imageapi.ImageStream, name string, met
var lock sync.Mutex
opts := extract.NewOptions(genericclioptions.IOStreams{Out: o.Out, ErrOut: o.ErrOut})
opts.RegistryConfig = o.RegistryConfig
opts.Insecure = o.Insecure
opts.OnlyFiles = true
opts.MaxPerRegistry = o.MaxPerRegistry
opts.ImageMetadataCallback = func(m *extract.Mapping, dgst digest.Digest, config *docker10.DockerImageConfig) {
Expand All @@ -771,6 +775,7 @@ func (o *NewOptions) extractManifests(is *imageapi.ImageStream, name string, met
Digest: dgst,
}
}
opts.Insecure = o.Insecure

for i := range is.Spec.Tags {
tag := &is.Spec.Tags[i]
Expand Down Expand Up @@ -855,6 +860,7 @@ func (o *NewOptions) mirrorImages(is *imageapi.ImageStream, payload *Payload) er
copied := is.DeepCopy()
opts := NewMirrorOptions(genericclioptions.IOStreams{Out: o.Out, ErrOut: o.ErrOut})
opts.DryRun = o.DryRun
opts.Insecure = o.Insecure
opts.ImageStream = copied
opts.To = o.Mirror
opts.SkipRelease = true
Expand Down Expand Up @@ -978,7 +984,8 @@ func (o *NewOptions) write(r io.Reader, is *imageapi.ImageStream, now time.Time)
options := imageappend.NewAppendImageOptions(genericclioptions.IOStreams{Out: o.Out, ErrOut: o.ErrOut})
options.RegistryConfig = o.RegistryConfig
options.DryRun = o.DryRun
options.From = toImageBase
options.Insecure = o.Insecure
options.From = o.ToImageBase
options.ConfigurationCallback = func(dgst digest.Digest, config *docker10.DockerImageConfig) error {
// reset any base image info
if len(config.OS) == 0 {
Expand Down