(ctx context.Context, projectName string, options api.CommitOptions)
| 33 | } |
| 34 | |
| 35 | func (s *composeService) commit(ctx context.Context, projectName string, options api.CommitOptions) error { |
| 36 | projectName = strings.ToLower(projectName) |
| 37 | |
| 38 | ctr, err := s.getSpecifiedContainer(ctx, projectName, oneOffInclude, false, options.Service, options.Index) |
| 39 | if err != nil { |
| 40 | return err |
| 41 | } |
| 42 | |
| 43 | name := getCanonicalContainerName(ctr) |
| 44 | |
| 45 | s.events.On(api.Resource{ |
| 46 | ID: name, |
| 47 | Status: api.Working, |
| 48 | Text: api.StatusCommitting, |
| 49 | }) |
| 50 | |
| 51 | if s.dryRun { |
| 52 | s.events.On(api.Resource{ |
| 53 | ID: name, |
| 54 | Status: api.Done, |
| 55 | Text: api.StatusCommitted, |
| 56 | }) |
| 57 | |
| 58 | return nil |
| 59 | } |
| 60 | |
| 61 | response, err := s.apiClient().ContainerCommit(ctx, ctr.ID, client.ContainerCommitOptions{ |
| 62 | Reference: options.Reference, |
| 63 | Comment: options.Comment, |
| 64 | Author: options.Author, |
| 65 | Changes: options.Changes.GetSlice(), |
| 66 | NoPause: !options.Pause, |
| 67 | }) |
| 68 | if err != nil { |
| 69 | return err |
| 70 | } |
| 71 | |
| 72 | s.events.On(api.Resource{ |
| 73 | ID: name, |
| 74 | Text: fmt.Sprintf("Committed as %s", response.ID), |
| 75 | Status: api.Done, |
| 76 | }) |
| 77 | |
| 78 | return nil |
| 79 | } |
no test coverage detected