Rename "DockerImage" to "DownloadLocation"

This commit is contained in:
John Gardiner Myers 2021-05-29 16:40:56 -07:00
parent 34c6f7f295
commit 95aa3fd13e
4 changed files with 13 additions and 13 deletions

View File

@ -110,7 +110,7 @@ func RunGetAssets(ctx context.Context, f *util.Factory, out io.Writer, options *
for _, containerAsset := range updateClusterResults.ImageAssets {
image := Image{
Image: containerAsset.CanonicalLocation,
Mirror: containerAsset.DockerImage,
Mirror: containerAsset.DownloadLocation,
}
if !seen[image.Image] {
result.Images = append(result.Images, &image)

View File

@ -65,9 +65,9 @@ type StaticManifest struct {
// ImageAsset models an image's location.
type ImageAsset struct {
// DockerImage will be the name of the image we should run.
// This is used to copy a container to a ContainerRegistry.
DockerImage string
// DownloadLocation will be the name of the image we should run.
// This is used to copy an image to a ContainerRegistry.
DownloadLocation string
// CanonicalLocation will be the source location of the image.
CanonicalLocation string
}
@ -121,7 +121,7 @@ func (a *AssetBuilder) RemapManifest(data []byte) ([]byte, error) {
// RemapImage normalizes a containers location if a user sets the AssetsLocation ContainerRegistry location.
func (a *AssetBuilder) RemapImage(image string) (string, error) {
asset := &ImageAsset{
DockerImage: image,
DownloadLocation: image,
CanonicalLocation: image,
}
@ -167,10 +167,10 @@ func (a *AssetBuilder) RemapImage(image string) (string, error) {
normalized = re.ReplaceAllString(normalized, containerProxy)
}
asset.DockerImage = normalized
asset.DownloadLocation = normalized
// Run the new image
image = asset.DockerImage
image = asset.DownloadLocation
}
if a.AssetsLocation != nil && a.AssetsLocation.ContainerRegistry != nil {
@ -189,11 +189,11 @@ func (a *AssetBuilder) RemapImage(image string) (string, error) {
// We can't nest arbitrarily
// Some risk of collisions, but also -- and __ in the names appear to be blocked by docker hub
normalized = strings.Replace(normalized, "/", "-", -1)
asset.DockerImage = registryMirror + "/" + normalized
asset.DownloadLocation = registryMirror + "/" + normalized
}
// Run the new image
image = asset.DockerImage
image = asset.DownloadLocation
}
a.ImageAssets = append(a.ImageAssets, asset)

View File

@ -67,15 +67,15 @@ func (l *Loader) BuildTasks(assetBuilder *assets.AssetBuilder, lifecycle *fi.Lif
func (l *Loader) addAssetCopyTasks(assets []*assets.ImageAsset, lifecycle *fi.Lifecycle) error {
for _, asset := range assets {
if asset.DockerImage != asset.CanonicalLocation {
if asset.DownloadLocation != asset.CanonicalLocation {
context := &fi.ModelBuilderContext{
Tasks: l.tasks,
}
copyImageTask := &assettasks.CopyDockerImage{
Name: fi.String(asset.DockerImage),
Name: fi.String(asset.DownloadLocation),
SourceImage: fi.String(asset.CanonicalLocation),
TargetImage: fi.String(asset.DockerImage),
TargetImage: fi.String(asset.DownloadLocation),
Lifecycle: lifecycle,
}

View File

@ -255,7 +255,7 @@ func (t *DryRunTarget) PrintReport(taskMap map[string]Task, out io.Writer) error
if len(t.assetBuilder.ImageAssets) != 0 {
klog.V(4).Infof("ImageAssets:")
for _, a := range t.assetBuilder.ImageAssets {
klog.V(4).Infof(" %s %s", a.DockerImage, a.CanonicalLocation)
klog.V(4).Infof(" %s %s", a.DownloadLocation, a.CanonicalLocation)
}
}