Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: milo/api/resp/build.go

Issue 2978293002: [milo] Add an (uncached) method to get console rows. (Closed)
Patch Set: make manifestkey its own type Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | milo/api/resp/console.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. 1 // Copyright 2015 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 //go:generate stringer -type=Verbosity 15 //go:generate stringer -type=Verbosity
16 //go:generate stringer -type=ComponentType 16 //go:generate stringer -type=ComponentType
17 17
18 package resp 18 package resp
19 19
20 import ( 20 import (
21 "encoding/hex" 21 "encoding/hex"
22 "encoding/json" 22 "encoding/json"
23 "strings"
23 "time" 24 "time"
24 25
25 "golang.org/x/net/context" 26 "golang.org/x/net/context"
26 27
27 "github.com/luci/luci-go/common/logging" 28 "github.com/luci/luci-go/common/logging"
28 "github.com/luci/luci-go/milo/common" 29 "github.com/luci/luci-go/milo/common"
29 "github.com/luci/luci-go/milo/common/model" 30 "github.com/luci/luci-go/milo/common/model"
30 ) 31 )
31 32
32 // MiloBuild denotes a full renderable Milo build page. 33 // MiloBuild denotes a full renderable Milo build page.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // Full URL of the main source repository. 98 // Full URL of the main source repository.
98 Repo string 99 Repo string
99 // Branch of the repo. 100 // Branch of the repo.
100 Branch string 101 Branch string
101 // Requested revision of the commit or base commit. 102 // Requested revision of the commit or base commit.
102 RequestRevision *Link 103 RequestRevision *Link
103 // Revision of the commit or base commit. 104 // Revision of the commit or base commit.
104 Revision *Link 105 Revision *Link
105 // The commit message. 106 // The commit message.
106 Description string 107 Description string
107 // The commit title, usually the first line of the commit message.
108 Title string
109 // Rietveld or Gerrit URL if the commit is a patch. 108 // Rietveld or Gerrit URL if the commit is a patch.
110 Changelist *Link 109 Changelist *Link
111 // Browsable URL of the commit. 110 // Browsable URL of the commit.
112 CommitURL string 111 CommitURL string
113 // List of changed filenames. 112 // List of changed filenames.
114 File []string 113 File []string
115 } 114 }
116 115
116 // Title is the first line of the commit message (Description).
117 func (c *Commit) Title() string {
118 switch lines := strings.SplitN(c.Description, "\n", 2); len(lines) {
119 case 0:
120 return ""
121 case 1:
122 return c.Description
123 default:
124 return lines[0]
125 }
126 }
127
117 // BuildProgress is a way to show progress. Percent should always be specified. 128 // BuildProgress is a way to show progress. Percent should always be specified.
118 type BuildProgress struct { 129 type BuildProgress struct {
119 // The total number of entries. Shows up as a tooltip. Leave at 0 to 130 // The total number of entries. Shows up as a tooltip. Leave at 0 to
120 // disable the tooltip. 131 // disable the tooltip.
121 total uint64 132 total uint64
122 133
123 // The number of entries completed. Shows up as <progress> / <total>. 134 // The number of entries completed. Shows up as <progress> / <total>.
124 progress uint64 135 progress uint64
125 136
126 // A number between 0 to 100 denoting the percentage completed. 137 // A number between 0 to 100 denoting the percentage completed.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 ID: []byte(rb.SourceStamp.Revision.Lab el), 316 ID: []byte(rb.SourceStamp.Revision.Lab el),
306 }) 317 })
307 consoles, err := common.GetConsolesForBuilder(c, bs.BuilderID) 318 consoles, err := common.GetConsolesForBuilder(c, bs.BuilderID)
308 if err != nil { 319 if err != nil {
309 return err 320 return err
310 } 321 }
311 for _, con := range consoles { 322 for _, con := range consoles {
312 // HACK(iannucci): Until we have real ma nifest support, console 323 // HACK(iannucci): Until we have real ma nifest support, console
313 // definitions will specify their manife st as "REVISION", and we'll do 324 // definitions will specify their manife st as "REVISION", and we'll do
314 // lookups with null URL fields. 325 // lookups with null URL fields.
315 » » » » » bs.AddManifestRevisionIndex( 326 » » » » » bs.AddManifestKey(
316 con.ProjectID, con.Console.Name, "REVISION", "", revisionBytes) 327 con.ProjectID, con.Console.Name, "REVISION", "", revisionBytes)
317 } 328 }
318 } 329 }
319 } 330 }
320 if rb.SourceStamp.Changelist != nil { 331 if rb.SourceStamp.Changelist != nil {
321 bs.Patches = append(bs.Patches, model.PatchInfo{ 332 bs.Patches = append(bs.Patches, model.PatchInfo{
322 Link: rb.SourceStamp.Changelist.Link, 333 Link: rb.SourceStamp.Changelist.Link,
323 AuthorEmail: rb.SourceStamp.AuthorEmail, 334 AuthorEmail: rb.SourceStamp.AuthorEmail,
324 }) 335 })
325 } 336 }
326 } 337 }
327 return nil 338 return nil
328 } 339 }
OLDNEW
« no previous file with comments | « no previous file | milo/api/resp/console.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698