Skip to content

Commit

Permalink
feat: test workflow status (#269)
Browse files Browse the repository at this point in the history
* feat: test workflow status

* feat: status types
  • Loading branch information
vsukhin authored Jun 3, 2024
1 parent c16a678 commit fa1c648
Show file tree
Hide file tree
Showing 5 changed files with 339 additions and 2 deletions.
51 changes: 51 additions & 0 deletions api/testworkflows/v1/status_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package v1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// TestWorkflowExecutionSummary contains TestWorkflow execution summary
type TestWorkflowExecutionSummary struct {
// unique execution identifier
Id string `json:"id"`
// execution name
Name string `json:"name"`
// sequence number for the execution
Number int32 `json:"number,omitempty"`
// when the execution has been scheduled to run
ScheduledAt metav1.Time `json:"scheduledAt,omitempty"`
// when the execution result's status has changed last time (queued, passed, failed)
StatusAt metav1.Time `json:"statusAt,omitempty"`
Result *TestWorkflowResultSummary `json:"result,omitempty"`
Workflow *TestWorkflowSummary `json:"workflow"`
}

// TestWorkflowResultSummary defines TestWorkflow result summary
type TestWorkflowResultSummary struct {
Status *TestWorkflowStatus `json:"status"`
PredictedStatus *TestWorkflowStatus `json:"predictedStatus"`
// when the pod was created
QueuedAt metav1.Time `json:"queuedAt,omitempty"`
// when the pod has been successfully assigned
StartedAt metav1.Time `json:"startedAt,omitempty"`
// when the pod has been completed
FinishedAt metav1.Time `json:"finishedAt,omitempty"`
// Go-formatted (human-readable) duration
Duration string `json:"duration,omitempty"`
// Go-formatted (human-readable) duration (incl. pause)
TotalDuration string `json:"totalDuration,omitempty"`
// Duration in milliseconds
DurationMs int32 `json:"durationMs"`
// Duration in milliseconds (incl. pause)
TotalDurationMs int32 `json:"totalDurationMs"`
// Pause duration in milliseconds
PausedMs int32 `json:"pausedMs"`
}

// TestWorkflowSummary fas TestWorkflow summary
type TestWorkflowSummary struct {
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
12 changes: 10 additions & 2 deletions api/testworkflows/v1/testworkflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ type TemplateRef struct {
Config map[string]intstr.IntOrString `json:"config,omitempty" expr:"template"`
}

// +kubebuilder:object:root=true
// test workflow status
type TestWorkflowStatusSummary struct {
LatestExecution *TestWorkflowExecutionSummary `json:"latestExecution,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion

// TestWorkflow is the Schema for the workflows API
type TestWorkflow struct {
Expand All @@ -59,7 +66,8 @@ type TestWorkflow struct {
Description string `json:"description,omitempty"`

// TestWorkflow specification
Spec TestWorkflowSpec `json:"spec" expr:"include"`
Spec TestWorkflowSpec `json:"spec" expr:"include"`
Status TestWorkflowStatusSummary `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
170 changes: 170 additions & 0 deletions api/testworkflows/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fa1c648

Please sign in to comment.