(ctx context.Context, serviceId string, releaseId string)
| 447 | |
| 448 | } |
| 449 | func (i *imlPublishModule) checkPublish(ctx context.Context, serviceId string, releaseId string) error { |
| 450 | flows, err := i.publishService.ListForStatus(ctx, serviceId, publish.StatusApply, publish.StatusAccept) |
| 451 | if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { |
| 452 | return err |
| 453 | } |
| 454 | if len(flows) > 0 { |
| 455 | return errors.New("正在发布中") |
| 456 | } |
| 457 | running, err := i.releaseService.GetRunning(ctx, serviceId) |
| 458 | if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { |
| 459 | return err |
| 460 | } |
| 461 | |
| 462 | if running == nil { |
| 463 | return nil |
| 464 | } |
| 465 | if running.UUID == releaseId { |
| 466 | return errors.New("不能申请发布当前版本") |
| 467 | } |
| 468 | return nil |
| 469 | } |
| 470 | func (i *imlPublishModule) Close(ctx context.Context, serviceId, id string) error { |
| 471 | err := i.publishService.SetStatus(ctx, serviceId, id, publish.StatusClose) |
| 472 | if err != nil { |
no test coverage detected