| 20 | } |
| 21 | |
| 22 | func (c *imlPublishController) ReleaseDo(ctx *gin.Context, serviceId string, input *dto.ApplyOnReleaseInput) (*dto.Publish, error) { |
| 23 | newReleaseId, err := c.releaseModule.Create(ctx, serviceId, &dto2.CreateInput{ |
| 24 | Version: input.Version, |
| 25 | Remark: input.VersionRemark, |
| 26 | }) |
| 27 | if err != nil { |
| 28 | return nil, err |
| 29 | } |
| 30 | apply, err := c.publishModule.Apply(ctx, serviceId, &dto.ApplyInput{ |
| 31 | Release: newReleaseId, |
| 32 | Remark: input.PublishRemark, |
| 33 | }) |
| 34 | if err != nil { |
| 35 | return nil, err |
| 36 | } |
| 37 | err = c.publishModule.Accept(ctx, serviceId, apply.Id, "") |
| 38 | if err != nil { |
| 39 | c.releaseModule.Delete(ctx, serviceId, newReleaseId) |
| 40 | return nil, err |
| 41 | } |
| 42 | |
| 43 | err = c.publishModule.Publish(ctx, serviceId, apply.Id) |
| 44 | if err != nil { |
| 45 | c.releaseModule.Delete(ctx, serviceId, newReleaseId) |
| 46 | return nil, err |
| 47 | } |
| 48 | return apply, err |
| 49 | } |
| 50 | |
| 51 | func (c *imlPublishController) PublishStatuses(ctx *gin.Context, serviceId string, id string) ([]*dto.PublishStatus, error) { |
| 52 | return c.publishModule.PublishStatuses(ctx, serviceId, id) |