-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1324 from sgratch/mark-migration-tasks-as-complet…
…ed-if-pipeline-is 🐞 when migration task isn't completed but the migration is successful, mark task as successful
- Loading branch information
Showing
5 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...es/forklift-console-plugin/src/modules/Plans/views/details/utils/hasPipelineCompleted.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { V1beta1PlanStatusMigrationVmsPipeline } from '@kubev2v/types'; | ||
|
||
/** | ||
* Check if a given migration's pipeline step has completed successfully. | ||
* | ||
* @param {V1beta1PlanStatusMigrationVmsPipeline} pipeline - A given migration's pipeline step | ||
* @returns {boolean} - True if the migration step has completed successfully, false otherwise. | ||
*/ | ||
export const hasPipelineCompleted = (pipeline: V1beta1PlanStatusMigrationVmsPipeline) => | ||
!pipeline?.error && pipeline?.phase === 'Completed'; |
18 changes: 18 additions & 0 deletions
18
packages/forklift-console-plugin/src/modules/Plans/views/details/utils/hasTaskCompleted.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { V1beta1PlanStatusMigrationVmsPipeline } from '@kubev2v/types'; | ||
|
||
import { hasPipelineCompleted } from './hasPipelineCompleted'; | ||
|
||
/** | ||
* Check if a given task within a pipeline has completed. | ||
* | ||
* A task if marked as completed successfully if its phase is marked as completed or if | ||
* its phase is not set but its contained pipeline step has completed successfully. | ||
* | ||
* @param {string } taskPhase A given task's phase | ||
* @param {V1beta1PlanStatusMigrationVmsPipeline} pipeline - A given migration's pipeline step which includes the task | ||
* @returns {boolean} - Returns true if the task has completed. | ||
*/ | ||
export const hasTaskCompleted = ( | ||
taskPhase: string, | ||
pipeline: V1beta1PlanStatusMigrationVmsPipeline, | ||
) => taskPhase === 'Completed' || (taskPhase === undefined && hasPipelineCompleted(pipeline)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters