-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Introduce
WorkflowPhase
(#4856)
Signed-off-by: Alex Collins <alex_collins@intuit.com>
- Loading branch information
Showing
34 changed files
with
746 additions
and
694 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,22 @@ | ||
package v1alpha1 | ||
|
||
// the workflow's phase | ||
type WorkflowPhase string | ||
|
||
const ( | ||
WorkflowUnknown WorkflowPhase = "" | ||
WorkflowPending WorkflowPhase = "Pending" // pending some set-up - rarely used | ||
WorkflowRunning WorkflowPhase = "Running" // any node has started; pods might not be running yet, the workflow maybe suspended too | ||
WorkflowSucceeded WorkflowPhase = "Succeeded" | ||
WorkflowFailed WorkflowPhase = "Failed" // it maybe that the the workflow was terminated | ||
WorkflowError WorkflowPhase = "Error" | ||
) | ||
|
||
func (p WorkflowPhase) Completed() bool { | ||
switch p { | ||
case WorkflowSucceeded, WorkflowFailed, WorkflowError: | ||
return true | ||
default: | ||
return false | ||
} | ||
} |
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,16 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestWorkflowPhase_Completed(t *testing.T) { | ||
assert.False(t, WorkflowUnknown.Completed()) | ||
assert.False(t, WorkflowPending.Completed()) | ||
assert.False(t, WorkflowRunning.Completed()) | ||
assert.True(t, WorkflowSucceeded.Completed()) | ||
assert.True(t, WorkflowFailed.Completed()) | ||
assert.True(t, WorkflowError.Completed()) | ||
} |
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
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
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
Oops, something went wrong.