コード例 #1
0
ファイル: prune_test.go プロジェクト: pweil-/origin
func imageWithLayers(id, ref string, configName *string, layers ...string) imageapi.Image {
	image := imageapi.Image{
		ObjectMeta: kapi.ObjectMeta{
			Name: id,
			Annotations: map[string]string{
				imageapi.ManagedByOpenShiftAnnotation: "true",
			},
		},
		DockerImageReference: ref,
	}

	if configName != nil {
		image.DockerImageMetadata = imageapi.DockerImage{
			ID: *configName,
		}
		image.DockerImageConfig = fmt.Sprintf("{Digest: %s}", *configName)
	}

	image.DockerImageLayers = []imageapi.ImageLayer{}
	for _, layer := range layers {
		image.DockerImageLayers = append(image.DockerImageLayers, imageapi.ImageLayer{Name: layer})
	}

	return image
}