Skip to content

Commit a755ab8

Browse files
committed
Refactor StageStatus constants for clarity and maintainability
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
1 parent 9a27453 commit a755ab8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pkg/plugin/sdk/deployment.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -455,16 +455,19 @@ type ExecuteStageResponse struct {
455455
type StageStatus int
456456

457457
const (
458-
StageStatusSuccess StageStatus = 2
459-
StageStatusFailure StageStatus = 3
460-
461-
// StageStatusSkipped StageStatus = 5 // TODO: If SDK can handle whole skipping, this is unnecessary.
462-
458+
_ StageStatus = iota
459+
// StageStatusSuccess indicates that the stage succeeded.
460+
StageStatusSuccess
461+
// StageStatusFailure indicates that the stage failed.
462+
StageStatusFailure
463463
// StageStatusExited can be used when the stage succeeded and exit the pipeline without executing the following stages.
464-
StageStatusExited StageStatus = 6
464+
StageStatusExited
465+
466+
// StageStatusSkipped // TODO: If SDK can handle whole skipping, this is unnecessary.
465467
)
466468

467469
// toModelEnum converts the StageStatus to the model.StageStatus.
470+
// It returns model.StageStatus_STAGE_FAILURE if the given value is invalid.
468471
func (o StageStatus) toModelEnum() model.StageStatus {
469472
switch o {
470473
case StageStatusSuccess:

0 commit comments

Comments
 (0)