Skip to content

Commit

Permalink
add a project holder string
Browse files Browse the repository at this point in the history
  • Loading branch information
motatoes committed Jan 25, 2024
1 parent 91fed84 commit 5c07339
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
8 changes: 3 additions & 5 deletions cli/pkg/digger/digger.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,9 @@ func RunJobs(
log.Printf("Failed to convert unmarshall Serialized job")
}

message = message + fmt.Sprintf(""+
"<!-- PROJECTHOLDER %v -->\n"+
"%v **%v** %v: [Resources: %v created, %v updated, %v deleted]\n"+
"<!-- PROJECTHOLDEREND %v -->\n"+
"", job.ProjectName, job.Status.ToEmoji(), jobjson.ProjectName, job.Status.ToString(), job.ResourcesCreated, job.ResourcesUpdated, job.ResourcesDeleted, job.ProjectName)
message = message + fmt.Sprintf("<!-- PROJECTHOLDER %v -->\n", job.ProjectName)
message = message + fmt.Sprintf("%v **%v** %v%v\n", job.Status.ToEmoji(), jobjson.ProjectName, job.ResourcesSummaryString(), job.Status.ToString())
message = message + fmt.Sprintf("<!-- PROJECTHOLDEREND %v -->\n", job.ProjectName)
}

fmt.Printf("!!!! interface")
Expand Down
14 changes: 12 additions & 2 deletions libs/orchestrator/scheduler/models.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scheduler

import "fmt"

type DiggerBatchStatus int8

const (
Expand Down Expand Up @@ -32,11 +34,11 @@ func (d *DiggerJobStatus) ToString() string {
case DiggerJobSucceeded:
return "succeeded"
case DiggerJobStarted:
return "started"
return "running"
case DiggerJobFailed:
return "failed"
case DiggerJobTriggered:
return "triggered"
return "running"
case DiggerJobCreated:
return "created"
default:
Expand Down Expand Up @@ -82,3 +84,11 @@ type SerializedBatch struct {
BatchType DiggerBatchType `json:"batch_type"`
Jobs []SerializedJob `json:"jobs"`
}

func (s *SerializedJob) ResourcesSummaryString() string {
if s.Status == DiggerJobSucceeded {
return fmt.Sprintf(" [Resources: %v created, %v updated, %v deleted]", s.ResourcesCreated, s.ResourcesUpdated, s.ResourcesDeleted)
} else {
return "..."
}
}

0 comments on commit 5c07339

Please sign in to comment.