Skip to content

Commit 40c25c0

Browse files
committed
app/appengine: remove unused tagHandler, document others, remove auth from init
tagHandler isn't used by anything. Delete. Less code to update. And document who calls the other handlers. Also, remove the auth requirement from the /init handler. It's harmless to call without auth, and the login restriction went away with the Go 1.12+ runtime anyway, so deleting it gets us closer to being able to use the Go 1.12/Go 1.13 runtimes. (The plan is to delete most the code, port the small remaining bit to the cloud.google.com/go libraries so we can update to Go 1.12/Go 1.13+, and then at that point, since the cloud.google.com/go code will run anywhere, we can just run it in the same process as the coordinator.) Updates golang/go#34744 Change-Id: I929c70945a3e9e27b38b1d5899c7860470361927 Reviewed-on: https://go-review.googlesource.com/c/build/+/208678 Reviewed-by: Bryan C. Mills <[email protected]>
1 parent 6e00cae commit 40c25c0

File tree

3 files changed

+9
-33
lines changed

3 files changed

+9
-33
lines changed

app/appengine/app.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ handlers:
55
- url: /static
66
static_dir: app/appengine/static
77
secure: always
8-
- url: /init
9-
script: auto
10-
login: admin
11-
secure: always
128
- url: /.*
139
script: auto
1410
secure: always

app/appengine/dash.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ func main() {
1818
handleFunc("/init", initHandler)
1919

2020
// authenticated handlers
21-
handleFunc("/building", AuthHandler(buildingHandler))
22-
handleFunc("/clear-results", AuthHandler(clearResultsHandler))
23-
handleFunc("/commit", AuthHandler(commitHandler))
24-
handleFunc("/packages", AuthHandler(packagesHandler))
25-
handleFunc("/result", AuthHandler(resultHandler))
26-
handleFunc("/tag", AuthHandler(tagHandler))
21+
handleFunc("/building", AuthHandler(buildingHandler)) // called by coordinator during builds
22+
handleFunc("/clear-results", AuthHandler(clearResultsHandler)) // called by x/build/cmd/retrybuilds
23+
handleFunc("/result", AuthHandler(resultHandler)) // called by coordinator after build
24+
25+
// TODO: once we use maintner for finding the git history
26+
// instead of having gitmirror mirror it into the dashboard,
27+
// then we can delete these two handlers:
28+
handleFunc("/commit", AuthHandler(commitHandler)) // called by gitmirror
29+
handleFunc("/packages", AuthHandler(packagesHandler)) // called by gitmirror
2730

2831
// public handlers
2932
handleFunc("/", uiHandler)

app/appengine/handler.go

-23
Original file line numberDiff line numberDiff line change
@@ -205,29 +205,6 @@ func addCommit(c context.Context, com *Commit) error {
205205
return nil
206206
}
207207

208-
// tagHandler records a new tag. It reads a JSON-encoded Tag value from the
209-
// request body and updates the Tag entity for the Kind of tag provided.
210-
//
211-
// This handler is used by a gobuilder process in -commit mode.
212-
func tagHandler(r *http.Request) (interface{}, error) {
213-
if r.Method != "POST" {
214-
return nil, errBadMethod(r.Method)
215-
}
216-
217-
t := new(Tag)
218-
defer r.Body.Close()
219-
if err := json.NewDecoder(r.Body).Decode(t); err != nil {
220-
return nil, err
221-
}
222-
if err := t.Valid(); err != nil {
223-
return nil, err
224-
}
225-
c := contextForRequest(r)
226-
defer cache.Tick(c)
227-
_, err := datastore.Put(c, t.Key(c), t)
228-
return nil, err
229-
}
230-
231208
// packagesHandler returns a list of the non-Go Packages monitored
232209
// by the dashboard.
233210
func packagesHandler(r *http.Request) (interface{}, error) {

0 commit comments

Comments
 (0)