Merge pull request #7436 from rhatdan/variant

Add support for image pull overrides
This commit is contained in:
OpenShift Merge Robot
2020-08-28 16:02:56 -04:00
committed by GitHub
16 changed files with 67 additions and 24 deletions

View File

@ -338,11 +338,12 @@ func ImagesPull(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
decoder := r.Context().Value("decoder").(*schema.Decoder)
query := struct {
Reference string `schema:"reference"`
OverrideOS string `schema:"overrideOS"`
OverrideArch string `schema:"overrideArch"`
TLSVerify bool `schema:"tlsVerify"`
AllTags bool `schema:"allTags"`
Reference string `schema:"reference"`
OverrideOS string `schema:"overrideOS"`
OverrideArch string `schema:"overrideArch"`
OverrideVariant string `schema:"overrideVariant"`
TLSVerify bool `schema:"tlsVerify"`
AllTags bool `schema:"allTags"`
}{
TLSVerify: true,
}
@ -393,6 +394,7 @@ func ImagesPull(w http.ResponseWriter, r *http.Request) {
DockerRegistryCreds: authConf,
OSChoice: query.OverrideOS,
ArchitectureChoice: query.OverrideArch,
VariantChoice: query.OverrideVariant,
}
if _, found := r.URL.Query()["tlsVerify"]; found {
dockerRegistryOptions.DockerInsecureSkipTLSVerify = types.NewOptionalBool(!query.TLSVerify)

View File

@ -905,12 +905,16 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: "username:password for the registry"
// type: string
// - in: query
// name: overrideArch
// description: Pull image for the specified architecture.
// type: string
// - in: query
// name: overrideOS
// description: Pull image for the specified operating system.
// type: string
// - in: query
// name: overrideArch
// description: Pull image for the specified architecture.
// name: overrideVariant
// description: Pull image for the specified variant.
// type: string
// - in: query
// name: tlsVerify

View File

@ -365,6 +365,7 @@ func Pull(ctx context.Context, rawImage string, options entities.ImagePullOption
params.Set("reference", rawImage)
params.Set("overrideArch", options.OverrideArch)
params.Set("overrideOS", options.OverrideOS)
params.Set("overrideVariant", options.OverrideVariant)
if options.SkipTLSVerify != types.OptionalBoolUndefined {
// Note: we have to verify if skipped is false.
verifyTLS := bool(options.SkipTLSVerify == types.OptionalBoolFalse)

View File

@ -137,6 +137,8 @@ type ImagePullOptions struct {
// OverrideOS will overwrite the local operating system (OS) for image
// pulls.
OverrideOS string
// OverrideVariant will overwrite the local variant for image pulls.
OverrideVariant string
// Quiet can be specified to suppress pull progress when pulling. Ignored
// for remote calls.
Quiet bool

View File

@ -251,6 +251,7 @@ func (ir *ImageEngine) Pull(ctx context.Context, rawImage string, options entiti
DockerCertPath: options.CertDir,
OSChoice: options.OverrideOS,
ArchitectureChoice: options.OverrideArch,
VariantChoice: options.OverrideVariant,
DockerInsecureSkipTLSVerify: options.SkipTLSVerify,
}