Skip to content

Commit c3f19ac

Browse files
authored
Update go-containerregistry that reverts API breaking change (#1137)
* Update go-containerregistry that reverts API breaking change * Change function name
1 parent 8f0b744 commit c3f19ac

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

container/go/cmd/join_layers/join_layers.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ var (
3838
stampInfoFiles utils.ArrayStringFlags
3939
)
4040

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
4242
// the tagged image and 'value' is the path to a file into a map from key to
4343
// 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)
4646
for _, t := range tags {
4747
split := strings.Split(t, "=")
4848
if len(split) != 2 {
4949
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))
5050
}
5151
img, configFile := split[0], split[1]
5252
stamped := stamper.Stamp(img)
53-
r, err := name.ParseReference(stamped, name.WeakValidation)
53+
t, err := name.NewTag(stamped, name.WeakValidation)
5454
if err != nil {
5555
return nil, errors.Wrapf(err, "unable to parse stamped image name %q as a fully qualified image reference", stamped)
5656
}
57-
result[r] = configFile
57+
result[t] = configFile
5858
}
5959
return result, nil
6060
}
@@ -76,16 +76,16 @@ func loadImageTarballs(imageTarballs []string) ([]v1.Image, error) {
7676
// the images defined by the given tag to config & manifest maps with the
7777
// layers defined by the given LayerParts deriving from images in the given
7878
// 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)
8181
images, err := loadImageTarballs(imageTarballs)
8282
if err != nil {
8383
return errors.Wrap(err, "unable to load images from the given tarballs")
8484
}
85-
for ref, configFile := range refToConfigs {
85+
for tag, configFile := range tagToConfigs {
8686
// Manifest file may not have been specified and this is ok as it's
8787
// only required if the base images has foreign layers.
88-
manifestFile := refToBaseManifests[ref]
88+
manifestFile := tagToBaseManifests[tag]
8989
parts := compat.ImageParts{
9090
Config: configFile,
9191
BaseManifest: manifestFile,
@@ -94,11 +94,11 @@ func writeOutput(outputTarball string, refToConfigs, refToBaseManifests map[name
9494
}
9595
img, err := compat.ReadImage(parts)
9696
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)
9898
}
99-
refToImg[ref] = img
99+
tagToImg[tag] = img
100100
}
101-
return tarball.MultiWriteToFile(outputTarball, refToImg)
101+
return tarball.MultiWriteToFile(outputTarball, tagToImg)
102102
}
103103

104104
func main() {
@@ -113,11 +113,11 @@ func main() {
113113
if err != nil {
114114
log.Fatalf("Unable to initialize stamper: %v", err)
115115
}
116-
refToConfig, err := parseRefToFilename(tags, stamper)
116+
tagToConfig, err := parseTagToFilename(tags, stamper)
117117
if err != nil {
118118
log.Fatalf("Unable to process values passed using the flag --tag: %v", err)
119119
}
120-
refToBaseManifest, err := parseRefToFilename(basemanifests, stamper)
120+
tagToBaseManifest, err := parseTagToFilename(basemanifests, stamper)
121121
if err != nil {
122122
log.Fatalf("Unable to process values passed using the flag --manifest: %v", err)
123123
}
@@ -129,7 +129,7 @@ func main() {
129129
}
130130
layerParts = append(layerParts, layer)
131131
}
132-
if err := writeOutput(*outputTarball, refToConfig, refToBaseManifest, sourceImages, layerParts); err != nil {
132+
if err := writeOutput(*outputTarball, tagToConfig, tagToBaseManifest, sourceImages, layerParts); err != nil {
133133
log.Fatalf("Failed to generate output at %s: %v", *outputTarball, err)
134134
}
135135
}

repositories/go_repositories.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def go_deps():
3737
if "com_github_google_go_containerregistry" not in excludes:
3838
go_repository(
3939
name = "com_github_google_go_containerregistry",
40-
commit = "0632dd120f814738b238b5c1368396a4af5c3bb3",
40+
commit = "a8228cdaedffd366395d5a0b3022cd2142fddadb",
4141
importpath = "github.com/google/go-containerregistry",
4242
)
4343
if "com_github_pkg_errors" not in excludes:

0 commit comments

Comments
 (0)