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 <bcmills@google.com>
This commit is contained in:
Brad Fitzpatrick 2019-11-24 19:10:09 +00:00
Родитель 6e00cae4ea
Коммит 40c25c0cae
3 изменённых файлов: 9 добавлений и 33 удалений

Просмотреть файл

@ -5,10 +5,6 @@ handlers:
- url: /static
static_dir: app/appengine/static
secure: always
- url: /init
script: auto
login: admin
secure: always
- url: /.*
script: auto
secure: always

Просмотреть файл

@ -18,12 +18,15 @@ func main() {
handleFunc("/init", initHandler)
// authenticated handlers
handleFunc("/building", AuthHandler(buildingHandler))
handleFunc("/clear-results", AuthHandler(clearResultsHandler))
handleFunc("/commit", AuthHandler(commitHandler))
handleFunc("/packages", AuthHandler(packagesHandler))
handleFunc("/result", AuthHandler(resultHandler))
handleFunc("/tag", AuthHandler(tagHandler))
handleFunc("/building", AuthHandler(buildingHandler)) // called by coordinator during builds
handleFunc("/clear-results", AuthHandler(clearResultsHandler)) // called by x/build/cmd/retrybuilds
handleFunc("/result", AuthHandler(resultHandler)) // called by coordinator after build
// TODO: once we use maintner for finding the git history
// instead of having gitmirror mirror it into the dashboard,
// then we can delete these two handlers:
handleFunc("/commit", AuthHandler(commitHandler)) // called by gitmirror
handleFunc("/packages", AuthHandler(packagesHandler)) // called by gitmirror
// public handlers
handleFunc("/", uiHandler)

Просмотреть файл

@ -205,29 +205,6 @@ func addCommit(c context.Context, com *Commit) error {
return nil
}
// tagHandler records a new tag. It reads a JSON-encoded Tag value from the
// request body and updates the Tag entity for the Kind of tag provided.
//
// This handler is used by a gobuilder process in -commit mode.
func tagHandler(r *http.Request) (interface{}, error) {
if r.Method != "POST" {
return nil, errBadMethod(r.Method)
}
t := new(Tag)
defer r.Body.Close()
if err := json.NewDecoder(r.Body).Decode(t); err != nil {
return nil, err
}
if err := t.Valid(); err != nil {
return nil, err
}
c := contextForRequest(r)
defer cache.Tick(c)
_, err := datastore.Put(c, t.Key(c), t)
return nil, err
}
// packagesHandler returns a list of the non-Go Packages monitored
// by the dashboard.
func packagesHandler(r *http.Request) (interface{}, error) {