fix: [CODE-2474]: handle import-progress API response for importing repos via the migrator (#2772)

pull/3571/head
Atefeh Mohseni Ejiyeh 2024-10-04 22:02:41 +00:00 committed by Harness
parent 2892378036
commit f1efecefee
1 changed files with 9 additions and 0 deletions

View File

@ -390,6 +390,15 @@ func (r *Repository) GetProgress(ctx context.Context, repo *types.Repository) (j
return job.FailProgress(), nil
}
// if repo is importing through the migrator cli there is no job created for it, return state=progress
if repo.State == enum.RepoStateMigrateDataImport ||
repo.State == enum.RepoStateMigrateGitPush {
return job.Progress{
State: job.JobStateRunning,
Progress: job.ProgressMin,
}, nil
}
// otherwise there either was no import, or it completed a long time ago (job cleaned up by now)
return job.Progress{}, ErrNotFound
}