MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / CheckPublish

Method CheckPublish

module/publish/iml.go:414–448  ·  view source on GitHub ↗
(ctx context.Context, serviceId string, releaseId string)

Source from the content-addressed store, hash-verified

412}
413
414func (i *imlPublishModule) CheckPublish(ctx context.Context, serviceId string, releaseId string) (*dto.DiffOut, error) {
415 _, err := i.serviceService.Check(ctx, serviceId, asServer)
416 if err != nil {
417 return nil, err
418 }
419 err = i.checkPublish(ctx, serviceId, releaseId)
420 if err != nil {
421 return nil, err
422 }
423
424 running, err := i.releaseService.GetRunning(ctx, serviceId)
425 if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
426 return nil, err
427 }
428 runningReleaseId := ""
429 if running != nil {
430 runningReleaseId = running.UUID
431 }
432 if releaseId == "" {
433 // 发布latest 版本
434 diff, _, err := i.projectDiffModule.DiffForLatest(ctx, serviceId, runningReleaseId)
435 if err != nil {
436 return nil, err
437 }
438 return i.projectDiffModule.Out(ctx, diff)
439 } else {
440 // 发布 releaseId 版本, 返回 与当前版本的差异
441 diff, err := i.projectDiffModule.Diff(ctx, serviceId, runningReleaseId, releaseId)
442 if err != nil {
443 return nil, err
444 }
445 return i.projectDiffModule.Out(ctx, diff)
446 }
447
448}
449func (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) {

Callers

nothing calls this directly

Calls 6

checkPublishMethod · 0.95
CheckMethod · 0.65
GetRunningMethod · 0.65
DiffForLatestMethod · 0.65
OutMethod · 0.65
DiffMethod · 0.65

Tested by

no test coverage detected