Remove {Git,Image}PushHook handlers in favour of NotifyChange
@@ -12,7 +12,6 @@ import (
"github.com/weaveworks/flux/api"
transport "github.com/weaveworks/flux/http"
- "github.com/weaveworks/flux/image"
"github.com/weaveworks/flux/job"
fluxmetrics "github.com/weaveworks/flux/metrics"
"github.com/weaveworks/flux/policy"
@@ -32,9 +31,6 @@ var (
func NewRouter() *mux.Router {
r := transport.NewAPIRouter()
- r.NewRoute().Methods("POST").Name("GitPushHook").Path("/v9/hook/git").Queries("repo", "{repo}")
- r.NewRoute().Methods("POST").Name("ImagePushHook").Path("/v9/hook/image").Queries("name", "{name}")
-
// All old versions are deprecated in the daemon. Use an up to
// date client!
transport.DeprecateVersions(r, "v1", "v2", "v3", "v4", "v5")
@@ -57,9 +53,6 @@ func NewHandler(s api.Server, r *mux.Router) http.Handler {
r.Get("Export").HandlerFunc(handle.Export)
r.Get("GitRepoConfig").HandlerFunc(handle.GitRepoConfig)
- r.Get("GitPushHook").HandlerFunc(handle.GitPushHook)
- r.Get("ImagePushHook").HandlerFunc(handle.ImagePushHook)
-
// These handlers persist to support requests from older fluxctls. In general we
// should avoid adding references to them so that they can eventually be removed.
r.Get("UpdateImages").HandlerFunc(handle.UpdateImages)
@@ -77,37 +70,6 @@ type HTTPServer struct {
server api.Server
}
-func (s HTTPServer) GitPushHook(w http.ResponseWriter, r *http.Request) {
- repo := mux.Vars(r)["repo"]
- err := s.server.NotifyChange(r.Context(), api.Change{
- Kind: api.GitChange,
- Source: api.GitUpdate{URL: repo},
- })
- if err != nil {
- transport.ErrorResponse(w, r, err)
- return
- }
- w.WriteHeader(http.StatusNoContent)
- return
-}
-
-func (s HTTPServer) ImagePushHook(w http.ResponseWriter, r *http.Request) {
- nameString := mux.Vars(r)["name"]
- ref, err := image.ParseRef(nameString)
- if err == nil {
- err = s.server.NotifyChange(r.Context(), api.Change{
- Kind: api.ImageChange,
- Source: api.ImageUpdate{Name: ref.Name},
- })
- }
- if err != nil {
- transport.ErrorResponse(w, r, err)
- return
- }
- w.WriteHeader(http.StatusNoContent)
- return
-}
-
func (s HTTPServer) JobStatus(w http.ResponseWriter, r *http.Request) {
id := job.ID(mux.Vars(r)["id"])
status, err := s.server.JobStatus(r.Context(), id)
