@@ -2,6 +2,7 @@ package release
2
2
3
3
import (
4
4
"fmt"
5
+ "os"
5
6
"time"
6
7
7
8
"github.com/spf13/cobra"
@@ -62,6 +63,9 @@ func (o *ExtractOptions) Run() error {
62
63
}
63
64
64
65
dir := o .Directory
66
+ if err := os .MkdirAll (dir , 0755 ); err != nil {
67
+ return err
68
+ }
65
69
66
70
src := o .From
67
71
ref , err := imagereference .Parse (src )
@@ -70,6 +74,7 @@ func (o *ExtractOptions) Run() error {
70
74
}
71
75
opts := extract .NewOptions (genericclioptions.IOStreams {Out : o .Out , ErrOut : o .ErrOut })
72
76
opts .OnlyFiles = true
77
+ opts .RemovePermissions = true
73
78
opts .Mappings = []extract.Mapping {
74
79
{
75
80
ImageRef : ref ,
@@ -80,9 +85,9 @@ func (o *ExtractOptions) Run() error {
80
85
}
81
86
opts .ImageMetadataCallback = func (m * extract.Mapping , dgst digest.Digest , config * docker10.DockerImageConfig ) {
82
87
if len (ref .ID ) > 0 {
83
- fmt .Fprintf (o .Out , "Extracted release payload from %s created at %s\n " , ref , config .Created .Format (time .RFC3339 ))
88
+ fmt .Fprintf (o .Out , "Extracted release payload created at %s\n " , config .Created .Format (time .RFC3339 ))
84
89
} else {
85
- fmt .Fprintf (o .Out , "Extracted release payload from %s ( digest %s) created at %s\n " , ref , dgst , config .Created .Format (time .RFC3339 ))
90
+ fmt .Fprintf (o .Out , "Extracted release payload from digest %s created at %s\n " , dgst , config .Created .Format (time .RFC3339 ))
86
91
}
87
92
}
88
93
if err := opts .Run (); err != nil {
0 commit comments