Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Commit

Permalink
common: add additional docker information to manifest.
Browse files Browse the repository at this point in the history
This adds additional docker information to the image manifest.
Now the v1 registry information are added under the `appc.io/docker/v1/`
namespace:

`appc.io/docker/v1/indexurl`
`appc.io/docker/v1/repository`
`appc.io/docker/v1/tag`
`appc.io/docker/v1/imageid`
`appc.io/docker/v1/parentimageid`
  • Loading branch information
sgotti committed Aug 10, 2015
1 parent f4921ff commit 60c1d27
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ import (
)

const (
defaultTag = "latest"
schemaVersion = "0.5.1"
defaultTag = "latest"
schemaVersion = "0.6.1"
appcDockerV1RegistryURL = "appc.io/docker/v1/registryurl"
appcDockerV1Repository = "appc.io/docker/v1/repository"
appcDockerV1Tag = "appc.io/docker/v1/tag"
appcDockerV1ImageID = "appc.io/docker/v1/imageid"
appcDockerV1ParentImageID = "appc.io/docker/v1/parentimageid"
)

func ParseDockerURL(arg string) *types.ParsedDockerURL {
Expand Down Expand Up @@ -159,6 +164,11 @@ func GenerateManifest(layerData types.DockerImageData, dockerURL *types.ParsedDo
annotations = append(annotations, appctypes.Annotation{Name: *commentKey, Value: layerData.Comment})
}

annotations = append(annotations, appctypes.Annotation{Name: *appctypes.MustACIdentifier(appcDockerV1RegistryURL), Value: dockerURL.IndexURL})
annotations = append(annotations, appctypes.Annotation{Name: *appctypes.MustACIdentifier(appcDockerV1Repository), Value: dockerURL.ImageName})
annotations = append(annotations, appctypes.Annotation{Name: *appctypes.MustACIdentifier(appcDockerV1ImageID), Value: layerData.ID})
annotations = append(annotations, appctypes.Annotation{Name: *appctypes.MustACIdentifier(appcDockerV1ParentImageID), Value: layerData.Parent})

genManifest.Labels = labels
genManifest.Annotations = annotations

Expand Down Expand Up @@ -202,6 +212,8 @@ func GenerateManifest(layerData types.DockerImageData, dockerURL *types.ParsedDo
parentImageName := appctypes.MustACIdentifier(parentImageNameString)

genManifest.Dependencies = append(genManifest.Dependencies, appctypes.Dependency{ImageName: *parentImageName, Labels: parentLabels})

annotations = append(annotations, appctypes.Annotation{Name: *appctypes.MustACIdentifier(appcDockerV1Tag), Value: dockerURL.Tag})
}

return genManifest, nil
Expand Down

0 comments on commit 60c1d27

Please sign in to comment.