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

Unified Diff: go/src/infra/tricium/service/gerrit-poller/handlers.go

Issue 2125603002: Adds initial Tricium service GAE configs (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: go/src/infra/tricium/service/gerrit-poller/handlers.go
diff --git a/go/src/infra/tricium/service/gerrit-poller/handlers.go b/go/src/infra/tricium/service/gerrit-poller/handlers.go
new file mode 100644
index 0000000000000000000000000000000000000000..419ac238b275d1f2c3bc2fdeed0073af4a3d9a8b
--- /dev/null
+++ b/go/src/infra/tricium/service/gerrit-poller/handlers.go
@@ -0,0 +1,43 @@
+package handlers
+
+import (
+ "fmt"
+ "net/http"
+
+ "appengine"
+ "appengine/taskqueue"
+)
+
+func init() {
+ http.HandleFunc("/gerrit-poller/status", statusPageHandler)
+ http.HandleFunc("/gerrit-poller/poll", pollHandler)
+}
+
+func statusPageHandler(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprint(w, statusPage)
+}
+
+func pollHandler(w http.ResponseWriter, r *http.Request) {
+ ctx := appengine.NewContext(r)
+
+ // TODO(emso): Poll Gerrit and convert changes to workflow event tasks.
+
+ // Enqueue workflow event task.
+ t := taskqueue.NewPOSTTask("/workflow-launcher/queue-handler", map[string][]string{"name": {"Analysis Request"}})
+ if _, err := taskqueue.Add(ctx, t, "workflow-launcher-queue"); err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+}
+
+var statusPage = `
+<html>
+<head><title>Tricium</title></head>
+<body>
+<font face="sans-serif">
+== T R I C I U M (Under Construction) ==
+<hr size="1">
+<p>Status of the Gerrit Poller ...</p>
+<hr size="1">
+</body>
+</html>`

Powered by Google App Engine
This is Rietveld 408576698