Browse code

pass --change changes to the commit job

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: rhatdan)

Daniel, Dao Quang Minh authored on 2014/09/29 17:03:56
Showing 2 changed files
... ...
@@ -1702,6 +1702,8 @@ func (cli *DockerCli) CmdCommit(args ...string) error {
1702 1702
 	flPause := cmd.Bool([]string{"p", "-pause"}, true, "Pause container during commit")
1703 1703
 	flComment := cmd.String([]string{"m", "-message"}, "", "Commit message")
1704 1704
 	flAuthor := cmd.String([]string{"a", "#author", "-author"}, "", "Author (e.g., \"John Hannibal Smith <hannibal@a-team.com>\")")
1705
+	flChanges := opts.NewListOpts(nil)
1706
+	cmd.Var(&flChanges, []string{"c", "-change"}, "Apply a modification before committing the image")
1705 1707
 	// FIXME: --run is deprecated, it will be replaced with inline Dockerfile commands.
1706 1708
 	flConfig := cmd.String([]string{"#run", "#-run"}, "", "This option is deprecated and will be removed in a future version in favor of inline Dockerfile-compatible commands")
1707 1709
 	cmd.Require(flag.Max, 2)
... ...
@@ -1726,6 +1728,7 @@ func (cli *DockerCli) CmdCommit(args ...string) error {
1726 1726
 	v.Set("tag", tag)
1727 1727
 	v.Set("comment", *flComment)
1728 1728
 	v.Set("author", *flAuthor)
1729
+	v.Set("changes", strings.Join(flChanges.GetAll(), "\n"))
1729 1730
 
1730 1731
 	if *flPause != true {
1731 1732
 		v.Set("pause", "0")
... ...
@@ -518,6 +518,7 @@ func postCommit(eng *engine.Engine, version version.Version, w http.ResponseWrit
518 518
 	job.Setenv("tag", r.Form.Get("tag"))
519 519
 	job.Setenv("author", r.Form.Get("author"))
520 520
 	job.Setenv("comment", r.Form.Get("comment"))
521
+	job.Setenv("changes", r.Form.Get("changes"))
521 522
 	job.SetenvSubEnv("config", &config)
522 523
 
523 524
 	job.Stdout.Add(stdoutBuffer)