op.#SaveImage: export the image ID
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
5a1d4bff62
commit
50d55a8885
@ -57,8 +57,7 @@ Load a docker image into a docker engine
|
|||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
| ------------- |:-------------: |:-------------: |
|
| ------------- |:-------------: |:-------------: |
|
||||||
|*ref* | `string` |Image ref |
|
|*id* | `string` |Image ID |
|
||||||
|*digest* | `string` |Image digest |
|
|
||||||
|
|
||||||
## docker.#Pull
|
## docker.#Pull
|
||||||
|
|
||||||
|
@ -914,22 +914,13 @@ func (p *Pipeline) SaveImage(ctx context.Context, op *compiler.Value, st llb.Sta
|
|||||||
return st, err
|
return st, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if digest, ok := resp.ExporterResponse["containerimage.digest"]; ok {
|
if id, ok := resp.ExporterResponse["containerimage.config.digest"]; ok {
|
||||||
imageRef := fmt.Sprintf(
|
|
||||||
"%s@%s",
|
|
||||||
resp.ExporterResponse["image.name"],
|
|
||||||
digest,
|
|
||||||
)
|
|
||||||
|
|
||||||
st = st.File(
|
st = st.File(
|
||||||
llb.Mkdir("/dagger", fs.FileMode(0755)),
|
llb.Mkdir("/dagger", fs.FileMode(0755)),
|
||||||
llb.WithCustomName(p.vertexNamef("Mkdir /dagger")),
|
llb.WithCustomName(p.vertexNamef("Mkdir /dagger")),
|
||||||
).File(
|
).File(
|
||||||
llb.Mkfile("/dagger/image_digest", fs.FileMode(0644), []byte(digest)),
|
llb.Mkfile("/dagger/image_id", fs.FileMode(0644), []byte(id)),
|
||||||
llb.WithCustomName(p.vertexNamef("Storing image digest to /dagger/image_digest")),
|
llb.WithCustomName(p.vertexNamef("Storing image id to /dagger/image_id")),
|
||||||
).File(
|
|
||||||
llb.Mkfile("/dagger/image_ref", fs.FileMode(0644), []byte(imageRef)),
|
|
||||||
llb.WithCustomName(p.vertexNamef("Storing image ref to /dagger/image_ref")),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,28 +155,15 @@ import (
|
|||||||
command: "docker load -i /src/image.tar"
|
command: "docker load -i /src/image.tar"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Image ref
|
// Image ID
|
||||||
ref: {
|
id: {
|
||||||
string
|
string
|
||||||
|
|
||||||
#up: [
|
#up: [
|
||||||
op.#Load & {from: save},
|
op.#Load & {from: save},
|
||||||
|
|
||||||
op.#Export & {
|
op.#Export & {
|
||||||
source: "/dagger/image_ref"
|
source: "/dagger/image_id"
|
||||||
},
|
|
||||||
]
|
|
||||||
} & dagger.#Output
|
|
||||||
|
|
||||||
// Image digest
|
|
||||||
digest: {
|
|
||||||
string
|
|
||||||
|
|
||||||
#up: [
|
|
||||||
op.#Load & {from: save},
|
|
||||||
|
|
||||||
op.#Export & {
|
|
||||||
source: "/dagger/image_digest"
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
} & dagger.#Output
|
} & dagger.#Output
|
||||||
|
Reference in New Issue
Block a user