mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Update manifest format for push
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
parent
188b56c836
commit
bcc0a343bb
1 changed files with 4 additions and 7 deletions
|
@ -43,7 +43,6 @@ func (s *TagStore) CmdManifest(job *engine.Job) engine.Status {
|
||||||
if !exists {
|
if !exists {
|
||||||
return job.Errorf("Tag does not exist for %s: %s", name, tag)
|
return job.Errorf("Tag does not exist for %s: %s", name, tag)
|
||||||
}
|
}
|
||||||
tarsums := make([]string, 0, 4)
|
|
||||||
layersSeen := make(map[string]bool)
|
layersSeen := make(map[string]bool)
|
||||||
|
|
||||||
layer, err := s.graph.Get(layerId)
|
layer, err := s.graph.Get(layerId)
|
||||||
|
@ -54,9 +53,10 @@ func (s *TagStore) CmdManifest(job *engine.Job) engine.Status {
|
||||||
return job.Errorf("Missing layer configuration")
|
return job.Errorf("Missing layer configuration")
|
||||||
}
|
}
|
||||||
manifest.Architecture = layer.Architecture
|
manifest.Architecture = layer.Architecture
|
||||||
|
manifest.FSLayers = make([]*registry.FSLayer, 0, 4)
|
||||||
|
manifest.History = make([]*registry.ManifestHistory, 0, 4)
|
||||||
var metadata runconfig.Config
|
var metadata runconfig.Config
|
||||||
metadata = *layer.Config
|
metadata = *layer.Config
|
||||||
history := make([]string, 0, cap(tarsums))
|
|
||||||
|
|
||||||
for ; layer != nil; layer, err = layer.GetParent() {
|
for ; layer != nil; layer, err = layer.GetParent() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -89,19 +89,16 @@ func (s *TagStore) CmdManifest(job *engine.Job) engine.Status {
|
||||||
tarId := tarSum.Sum(nil)
|
tarId := tarSum.Sum(nil)
|
||||||
// Save tarsum to image json
|
// Save tarsum to image json
|
||||||
|
|
||||||
tarsums = append(tarsums, tarId)
|
manifest.FSLayers = append(manifest.FSLayers, ®istry.FSLayer{BlobSum: tarId})
|
||||||
|
|
||||||
layersSeen[layer.ID] = true
|
layersSeen[layer.ID] = true
|
||||||
jsonData, err := ioutil.ReadFile(path.Join(s.graph.Root, layer.ID, "json"))
|
jsonData, err := ioutil.ReadFile(path.Join(s.graph.Root, layer.ID, "json"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return job.Error(fmt.Errorf("Cannot retrieve the path for {%s}: %s", layer.ID, err))
|
return job.Error(fmt.Errorf("Cannot retrieve the path for {%s}: %s", layer.ID, err))
|
||||||
}
|
}
|
||||||
history = append(history, string(jsonData))
|
manifest.History = append(manifest.History, ®istry.ManifestHistory{V1Compatibility: string(jsonData)})
|
||||||
}
|
}
|
||||||
|
|
||||||
manifest.BlobSums = tarsums
|
|
||||||
manifest.History = history
|
|
||||||
|
|
||||||
manifestBytes, err := json.MarshalIndent(manifest, "", " ")
|
manifestBytes, err := json.MarshalIndent(manifest, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return job.Error(err)
|
return job.Error(err)
|
||||||
|
|
Loading…
Reference in a new issue