github.com/chenbh/concourse/v6@v6.4.2/atc/event/events.go (about) 1 package event 2 3 import ( 4 "github.com/chenbh/concourse/v6/atc" 5 ) 6 7 type Error struct { 8 Message string `json:"message"` 9 Origin Origin `json:"origin"` 10 Time int64 `json:"time"` 11 } 12 13 func (Error) EventType() atc.EventType { return EventTypeError } 14 func (Error) Version() atc.EventVersion { return "4.1" } 15 16 type FinishTask struct { 17 Time int64 `json:"time"` 18 ExitStatus int `json:"exit_status"` 19 Origin Origin `json:"origin"` 20 } 21 22 func (FinishTask) EventType() atc.EventType { return EventTypeFinishTask } 23 func (FinishTask) Version() atc.EventVersion { return "4.0" } 24 25 type InitializeTask struct { 26 Time int64 `json:"time"` 27 Origin Origin `json:"origin"` 28 TaskConfig TaskConfig `json:"config"` 29 } 30 31 func (InitializeTask) EventType() atc.EventType { return EventTypeInitializeTask } 32 func (InitializeTask) Version() atc.EventVersion { return "4.0" } 33 34 // shadow the real atc.TaskConfig 35 type TaskConfig struct { 36 Platform string `json:"platform"` 37 Image string `json:"image"` 38 39 Run TaskRunConfig `json:"run"` 40 Inputs []TaskInputConfig `json:"inputs"` 41 } 42 43 type TaskRunConfig struct { 44 Path string `json:"path"` 45 Args []string `json:"args"` 46 Dir string `json:"dir"` 47 } 48 49 type TaskInputConfig struct { 50 Name string `json:"name"` 51 Path string `json:"path"` 52 } 53 54 func ShadowTaskConfig(config atc.TaskConfig) TaskConfig { 55 var inputConfigs []TaskInputConfig 56 57 for _, input := range config.Inputs { 58 inputConfigs = append(inputConfigs, TaskInputConfig{ 59 Name: input.Name, 60 Path: input.Path, 61 }) 62 } 63 64 return TaskConfig{ 65 Platform: config.Platform, 66 Image: config.RootfsURI, 67 Run: TaskRunConfig{ 68 Path: config.Run.Path, 69 Args: config.Run.Args, 70 Dir: config.Run.Dir, 71 }, 72 Inputs: inputConfigs, 73 } 74 } 75 76 type StartTask struct { 77 Time int64 `json:"time"` 78 Origin Origin `json:"origin"` 79 TaskConfig TaskConfig `json:"config"` 80 } 81 82 func (StartTask) EventType() atc.EventType { return EventTypeStartTask } 83 func (StartTask) Version() atc.EventVersion { return "5.0" } 84 85 type Status struct { 86 Status atc.BuildStatus `json:"status"` 87 Time int64 `json:"time"` 88 } 89 90 func (Status) EventType() atc.EventType { return EventTypeStatus } 91 func (Status) Version() atc.EventVersion { return "1.0" } 92 93 type SelectedWorker struct { 94 Time int64 `json:"time"` 95 Origin Origin `json:"origin"` 96 WorkerName string `json:"selected_worker"` 97 } 98 99 func (SelectedWorker) EventType() atc.EventType { return EventTypeSelectedWorker } 100 func (SelectedWorker) Version() atc.EventVersion { return "1.0" } 101 102 type Log struct { 103 Time int64 `json:"time"` 104 Origin Origin `json:"origin"` 105 Payload string `json:"payload"` 106 } 107 108 func (Log) EventType() atc.EventType { return EventTypeLog } 109 func (Log) Version() atc.EventVersion { return "5.1" } 110 111 type Origin struct { 112 ID OriginID `json:"id,omitempty"` 113 Source OriginSource `json:"source,omitempty"` 114 } 115 116 type OriginID string 117 118 type OriginSource string 119 120 const ( 121 OriginSourceStdout OriginSource = "stdout" 122 OriginSourceStderr OriginSource = "stderr" 123 ) 124 125 type InitializeGet struct { 126 Origin Origin `json:"origin"` 127 Time int64 `json:"time,omitempty"` 128 } 129 130 func (InitializeGet) EventType() atc.EventType { return EventTypeInitializeGet } 131 func (InitializeGet) Version() atc.EventVersion { return "2.0" } 132 133 type StartGet struct { 134 Origin Origin `json:"origin"` 135 Time int64 `json:"time,omitempty"` 136 } 137 138 func (StartGet) EventType() atc.EventType { return EventTypeStartGet } 139 func (StartGet) Version() atc.EventVersion { return "1.0" } 140 141 type FinishGet struct { 142 Origin Origin `json:"origin"` 143 Time int64 `json:"time"` 144 ExitStatus int `json:"exit_status"` 145 FetchedVersion atc.Version `json:"version"` 146 FetchedMetadata []atc.MetadataField `json:"metadata,omitempty"` 147 } 148 149 func (FinishGet) EventType() atc.EventType { return EventTypeFinishGet } 150 func (FinishGet) Version() atc.EventVersion { return "5.1" } 151 152 type InitializePut struct { 153 Origin Origin `json:"origin"` 154 Time int64 `json:"time,omitempty"` 155 } 156 157 func (InitializePut) EventType() atc.EventType { return EventTypeInitializePut } 158 func (InitializePut) Version() atc.EventVersion { return "2.0" } 159 160 type StartPut struct { 161 Origin Origin `json:"origin"` 162 Time int64 `json:"time,omitempty"` 163 } 164 165 func (StartPut) EventType() atc.EventType { return EventTypeStartPut } 166 func (StartPut) Version() atc.EventVersion { return "1.0" } 167 168 type FinishPut struct { 169 Origin Origin `json:"origin"` 170 Time int64 `json:"time"` 171 ExitStatus int `json:"exit_status"` 172 CreatedVersion atc.Version `json:"version"` 173 CreatedMetadata []atc.MetadataField `json:"metadata,omitempty"` 174 } 175 176 func (FinishPut) EventType() atc.EventType { return EventTypeFinishPut } 177 func (FinishPut) Version() atc.EventVersion { return "5.1" } 178 179 type Initialize struct { 180 Origin Origin `json:"origin"` 181 Time int64 `json:"time,omitempty"` 182 } 183 184 func (Initialize) EventType() atc.EventType { return EventTypeInitialize } 185 func (Initialize) Version() atc.EventVersion { return "1.0" } 186 187 type Start struct { 188 Origin Origin `json:"origin"` 189 Time int64 `json:"time,omitempty"` 190 } 191 192 func (Start) EventType() atc.EventType { return EventTypeStart } 193 func (Start) Version() atc.EventVersion { return "1.0" } 194 195 type Finish struct { 196 Origin Origin `json:"origin"` 197 Time int64 `json:"time"` 198 Succeeded bool `json:"succeeded"` 199 } 200 201 func (Finish) EventType() atc.EventType { return EventTypeFinish } 202 func (Finish) Version() atc.EventVersion { return "1.0" }