aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cli/internal/runsummary/spaces.go
diff options
context:
space:
mode:
author简律纯 <hsiangnianian@outlook.com>2023-04-28 01:36:55 +0800
committer简律纯 <hsiangnianian@outlook.com>2023-04-28 01:36:55 +0800
commitfc8c5fdce62fb229202659408798a7b6c98f6e8b (patch)
tree7554f80e50de4af6fd255afa7c21bcdd58a7af34 /cli/internal/runsummary/spaces.go
parentdd84b9d64fb98746a230cd24233ff50a562c39c9 (diff)
downloadHydroRoll-fc8c5fdce62fb229202659408798a7b6c98f6e8b.tar.gz
HydroRoll-fc8c5fdce62fb229202659408798a7b6c98f6e8b.zip
Diffstat (limited to 'cli/internal/runsummary/spaces.go')
-rw-r--r--cli/internal/runsummary/spaces.go96
1 files changed, 0 insertions, 96 deletions
diff --git a/cli/internal/runsummary/spaces.go b/cli/internal/runsummary/spaces.go
deleted file mode 100644
index bf19941..0000000
--- a/cli/internal/runsummary/spaces.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package runsummary
-
-import (
- "github.com/vercel/turbo/cli/internal/ci"
-)
-
-// spacesRunResponse deserialized the response from POST Run endpoint
-type spacesRunResponse struct {
- ID string
- URL string
-}
-
-type spacesRunPayload struct {
- StartTime int64 `json:"startTime,omitempty"` // when the run was started
- EndTime int64 `json:"endTime,omitempty"` // when the run ended. we should never submit start and end at the same time.
- Status string `json:"status,omitempty"` // Status is "running" or "completed"
- Type string `json:"type,omitempty"` // hardcoded to "TURBO"
- ExitCode int `json:"exitCode,omitempty"` // exit code for the full run
- Command string `json:"command,omitempty"` // the thing that kicked off the turbo run
- RepositoryPath string `json:"repositoryPath,omitempty"` // where the command was invoked from
- Context string `json:"context,omitempty"` // the host on which this Run was executed (e.g. Github Action, Vercel, etc)
-
- // TODO: we need to add these in
- // originationUser string
- // gitBranch string
- // gitSha string
-}
-
-// spacesCacheStatus is the same as TaskCacheSummary so we can convert
-// spacesCacheStatus(cacheSummary), but change the json tags, to omit local and remote fields
-type spacesCacheStatus struct {
- // omitted fields, but here so we can convert from TaskCacheSummary easily
- Local bool `json:"-"`
- Remote bool `json:"-"`
- Status string `json:"status"` // should always be there
- Source string `json:"source,omitempty"`
- TimeSaved int `json:"timeSaved"`
-}
-
-type spacesTask struct {
- Key string `json:"key,omitempty"`
- Name string `json:"name,omitempty"`
- Workspace string `json:"workspace,omitempty"`
- Hash string `json:"hash,omitempty"`
- StartTime int64 `json:"startTime,omitempty"`
- EndTime int64 `json:"endTime,omitempty"`
- Cache spacesCacheStatus `json:"cache,omitempty"`
- ExitCode int `json:"exitCode,omitempty"`
- Dependencies []string `json:"dependencies,omitempty"`
- Dependents []string `json:"dependents,omitempty"`
- Logs string `json:"log"`
-}
-
-func (rsm *Meta) newSpacesRunCreatePayload() *spacesRunPayload {
- startTime := rsm.RunSummary.ExecutionSummary.startedAt.UnixMilli()
- context := "LOCAL"
- if name := ci.Constant(); name != "" {
- context = name
- }
- return &spacesRunPayload{
- StartTime: startTime,
- Status: "running",
- Command: rsm.synthesizedCommand,
- RepositoryPath: rsm.repoPath.ToString(),
- Type: "TURBO",
- Context: context,
- }
-}
-
-func newSpacesDonePayload(runsummary *RunSummary) *spacesRunPayload {
- endTime := runsummary.ExecutionSummary.endedAt.UnixMilli()
- return &spacesRunPayload{
- Status: "completed",
- EndTime: endTime,
- ExitCode: runsummary.ExecutionSummary.exitCode,
- }
-}
-
-func newSpacesTaskPayload(taskSummary *TaskSummary) *spacesTask {
- startTime := taskSummary.Execution.startAt.UnixMilli()
- endTime := taskSummary.Execution.endTime().UnixMilli()
-
- return &spacesTask{
- Key: taskSummary.TaskID,
- Name: taskSummary.Task,
- Workspace: taskSummary.Package,
- Hash: taskSummary.Hash,
- StartTime: startTime,
- EndTime: endTime,
- Cache: spacesCacheStatus(taskSummary.CacheSummary), // wrapped so we can remove fields
- ExitCode: *taskSummary.Execution.exitCode,
- Dependencies: taskSummary.Dependencies,
- Dependents: taskSummary.Dependents,
- Logs: string(taskSummary.GetLogs()),
- }
-}