func eventToDeployData(evt *event.Event, validImages set.Set, full bool) *DeployData { data := &DeployData{ ID: evt.UniqueID, App: evt.Target.Value, Timestamp: evt.StartTime, Duration: evt.EndTime.Sub(evt.StartTime), Error: evt.Error, User: evt.Owner.Name, } var startOpts DeployOptions err := evt.StartData(&startOpts) if err == nil { data.Commit = startOpts.Commit data.Origin = startOpts.GetOrigin() } if full { data.Log = evt.Log var otherData map[string]string err = evt.OtherData(&otherData) if err == nil { data.Diff = otherData["diff"] } } var endData map[string]string err = evt.EndData(&endData) if err == nil { data.Image = endData["image"] if validImages != nil { data.CanRollback = validImages.Includes(data.Image) if reImageVersion.MatchString(data.Image) { parts := reImageVersion.FindAllStringSubmatch(data.Image, -1) data.Image = parts[0][0] } } } return data }