Merge pull request #12914 from rhatdan/commit

Handle changes in docker compat mode
This commit is contained in:
OpenShift Merge Robot 2022-01-19 17:19:00 -05:00 committed by GitHub
commit d2c892c729
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 1 deletions

View File

@ -138,7 +138,9 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) {
options.Message = query.Comment options.Message = query.Comment
options.Author = query.Author options.Author = query.Author
options.Pause = query.Pause options.Pause = query.Pause
options.Changes = strings.Fields(query.Changes) if query.Changes != "" {
options.Changes = strings.Split(query.Changes, ",")
}
ctr, err := runtime.LookupContainer(query.Container) ctr, err := runtime.LookupContainer(query.Container)
if err != nil { if err != nil {
utils.Error(w, "Something went wrong.", http.StatusNotFound, err) utils.Error(w, "Something went wrong.", http.StatusNotFound, err)

View File

@ -420,3 +420,29 @@ t GET containers/$cid/json 200 \
.HostConfig.Binds[0]~/tmp:/mnt:.* \ .HostConfig.Binds[0]~/tmp:/mnt:.* \
t DELETE containers/$cid?v=true 204 t DELETE containers/$cid?v=true 204
# test apiv2 create/commit
t POST containers/create \
Image=$IMAGE \
Entrypoint='["echo"]' \
Cmd='["param1","param2"]' \
201 \
.Id~[0-9a-f]\\{64\\}
cid=$(jq -r '.Id' <<<"$output")
# No such container
t POST "commit?container=nonesuch" 404
cparam="repo=newrepo&tag=v3&comment=abcd&author=eric"
cparam="$cparam&format=docker&changes=CMD=/bin/bar,EXPOSE=9090"
t POST "commit?container=${cid:0:12}&$cparam" 201 \
.Id~[0-9a-f]\\{64\\}
iid=$(jq -r '.Id' <<<"$output")
t GET images/$iid/json 200 \
.RepoTags[0]=docker.io/library/newrepo:v3 \
.Config.ExposedPorts~.*"9090/tcp" \
.Config.Cmd~.*"/bin/bar" \
.Comment="abcd"
t DELETE containers/$cid 204
t DELETE images/docker.io/library/newrepo:v3?force=false 200