@@ -38,23 +38,23 @@ var (
38
38
stampInfoFiles utils.ArrayStringFlags
39
39
)
40
40
41
- // parseRefToFilename converts a list of key=value where 'key' is the name of
41
+ // parseTagToFilename converts a list of key=value where 'key' is the name of
42
42
// the tagged image and 'value' is the path to a file into a map from key to
43
43
// value.
44
- func parseRefToFilename (tags []string , stamper * compat.Stamper ) (map [name.Reference ]string , error ) {
45
- result := make (map [name.Reference ]string )
44
+ func parseTagToFilename (tags []string , stamper * compat.Stamper ) (map [name.Tag ]string , error ) {
45
+ result := make (map [name.Tag ]string )
46
46
for _ , t := range tags {
47
47
split := strings .Split (t , "=" )
48
48
if len (split ) != 2 {
49
49
return nil , errors .Errorf ("%q was not specified in the expected key=value format because it split into %q with unexpected number of elements by '=', got %d, want 2" , t , split , len (split ))
50
50
}
51
51
img , configFile := split [0 ], split [1 ]
52
52
stamped := stamper .Stamp (img )
53
- r , err := name .ParseReference (stamped , name .WeakValidation )
53
+ t , err := name .NewTag (stamped , name .WeakValidation )
54
54
if err != nil {
55
55
return nil , errors .Wrapf (err , "unable to parse stamped image name %q as a fully qualified image reference" , stamped )
56
56
}
57
- result [r ] = configFile
57
+ result [t ] = configFile
58
58
}
59
59
return result , nil
60
60
}
@@ -76,16 +76,16 @@ func loadImageTarballs(imageTarballs []string) ([]v1.Image, error) {
76
76
// the images defined by the given tag to config & manifest maps with the
77
77
// layers defined by the given LayerParts deriving from images in the given
78
78
// tarballs.
79
- func writeOutput (outputTarball string , refToConfigs , refToBaseManifests map [name.Reference ]string , imageTarballs []string , layerParts []compat.LayerParts ) error {
80
- refToImg := make (map [name.Reference ]v1.Image )
79
+ func writeOutput (outputTarball string , tagToConfigs , tagToBaseManifests map [name.Tag ]string , imageTarballs []string , layerParts []compat.LayerParts ) error {
80
+ tagToImg := make (map [name.Tag ]v1.Image )
81
81
images , err := loadImageTarballs (imageTarballs )
82
82
if err != nil {
83
83
return errors .Wrap (err , "unable to load images from the given tarballs" )
84
84
}
85
- for ref , configFile := range refToConfigs {
85
+ for tag , configFile := range tagToConfigs {
86
86
// Manifest file may not have been specified and this is ok as it's
87
87
// only required if the base images has foreign layers.
88
- manifestFile := refToBaseManifests [ ref ]
88
+ manifestFile := tagToBaseManifests [ tag ]
89
89
parts := compat.ImageParts {
90
90
Config : configFile ,
91
91
BaseManifest : manifestFile ,
@@ -94,11 +94,11 @@ func writeOutput(outputTarball string, refToConfigs, refToBaseManifests map[name
94
94
}
95
95
img , err := compat .ReadImage (parts )
96
96
if err != nil {
97
- return errors .Wrapf (err , "unable to load image %v corresponding to config %s" , ref , configFile )
97
+ return errors .Wrapf (err , "unable to load image %v corresponding to config %s" , tag , configFile )
98
98
}
99
- refToImg [ ref ] = img
99
+ tagToImg [ tag ] = img
100
100
}
101
- return tarball .MultiWriteToFile (outputTarball , refToImg )
101
+ return tarball .MultiWriteToFile (outputTarball , tagToImg )
102
102
}
103
103
104
104
func main () {
@@ -113,11 +113,11 @@ func main() {
113
113
if err != nil {
114
114
log .Fatalf ("Unable to initialize stamper: %v" , err )
115
115
}
116
- refToConfig , err := parseRefToFilename (tags , stamper )
116
+ tagToConfig , err := parseTagToFilename (tags , stamper )
117
117
if err != nil {
118
118
log .Fatalf ("Unable to process values passed using the flag --tag: %v" , err )
119
119
}
120
- refToBaseManifest , err := parseRefToFilename (basemanifests , stamper )
120
+ tagToBaseManifest , err := parseTagToFilename (basemanifests , stamper )
121
121
if err != nil {
122
122
log .Fatalf ("Unable to process values passed using the flag --manifest: %v" , err )
123
123
}
@@ -129,7 +129,7 @@ func main() {
129
129
}
130
130
layerParts = append (layerParts , layer )
131
131
}
132
- if err := writeOutput (* outputTarball , refToConfig , refToBaseManifest , sourceImages , layerParts ); err != nil {
132
+ if err := writeOutput (* outputTarball , tagToConfig , tagToBaseManifest , sourceImages , layerParts ); err != nil {
133
133
log .Fatalf ("Failed to generate output at %s: %v" , * outputTarball , err )
134
134
}
135
135
}
0 commit comments