From 066e3579cbfc109e2d7e60b5f11ec48b0f1dcd60 Mon Sep 17 00:00:00 2001 From: Harold Woo Date: Mon, 14 May 2018 15:23:51 -0700 Subject: [PATCH 1/2] initial commit --- main.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 52ad8e4..3925275 100644 --- a/main.go +++ b/main.go @@ -17,8 +17,8 @@ func init() { func main() { app := cli.NewApp() - app.Name = "cloudops-deployment-dockerhub-proxy" - app.Usage = "Listens for requests from dockerhub webhooks and triggers Jenkins pipelines." + app.Name = "cloudops-deployment-proxy" + app.Usage = "Listens for requests from dockerhub and github webhooks and triggers Jenkins pipelines." app.Flags = []cli.Flag{ cli.StringFlag{ Name: "addr, a", @@ -54,7 +54,7 @@ func main() { return cli.NewExitError(err.Error(), 1) } - handler := proxyservice.NewDockerHubWebhookHandler( + dockerhandler := proxyservice.NewDockerHubWebhookHandler( proxyservice.NewJenkins( c.String("jenkins-base-url"), c.String("jenkins-user"), @@ -63,8 +63,14 @@ func main() { c.StringSlice("valid-namespace")..., ) + githubhuandler := proxyservice.NewGithubWebhookHandler( + // TODO Implement me to include a newjenkins service, namespace, and other things? + // newfile proxyservice/github.go and add handler to handlers.go and add trigger func to jenkins.go + ) + mux := http.NewServeMux() - mux.Handle("/dockerhub", handler) + mux.Handle("/dockerhub", dockerhandler) + mux.Handle("/github", githubhandler) mux.HandleFunc("/__heartbeat__", func(w http.ResponseWriter, req *http.Request) { w.Write([]byte("OK")) }) From 669da6379db7455ff7d85a955068b52b4bcb4e4e Mon Sep 17 00:00:00 2001 From: Harold Woo Date: Mon, 14 May 2018 15:36:24 -0700 Subject: [PATCH 2/2] change github to travis --- main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 3925275..9e2d62d 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ func init() { func main() { app := cli.NewApp() app.Name = "cloudops-deployment-proxy" - app.Usage = "Listens for requests from dockerhub and github webhooks and triggers Jenkins pipelines." + app.Usage = "Listens for requests from dockerhub and travisci webhooks and triggers Jenkins pipelines." app.Flags = []cli.Flag{ cli.StringFlag{ Name: "addr, a", @@ -63,14 +63,15 @@ func main() { c.StringSlice("valid-namespace")..., ) - githubhuandler := proxyservice.NewGithubWebhookHandler( + travishuandler := proxyservice.NewTravisWebhookHandler( // TODO Implement me to include a newjenkins service, namespace, and other things? - // newfile proxyservice/github.go and add handler to handlers.go and add trigger func to jenkins.go + // newfile proxyservice/travis.go and add handler to handlers.go and add trigger func to jenkins.go + // add tests ) mux := http.NewServeMux() mux.Handle("/dockerhub", dockerhandler) - mux.Handle("/github", githubhandler) + mux.Handle("/travis", githubhandler) mux.HandleFunc("/__heartbeat__", func(w http.ResponseWriter, req *http.Request) { w.Write([]byte("OK")) })