diff --git a/jenkins.go b/jenkins.go index 37331cf..512de37 100644 --- a/jenkins.go +++ b/jenkins.go @@ -93,6 +93,10 @@ func (jenkins *Jenkins) post(path string, params url.Values, body interface{}) ( return } + if resp.StatusCode != http.StatusCreated { + return fmt.Errorf("unexpected response code: %d", resp.StatusCode) + } + return jenkins.parseResponse(resp, body) } diff --git a/plugin.go b/plugin.go index cc2ea83..ebdd4f4 100644 --- a/plugin.go +++ b/plugin.go @@ -2,6 +2,7 @@ package main import ( "errors" + "log" "strings" ) @@ -53,6 +54,7 @@ func (p Plugin) Exec() error { if err := jenkins.trigger(v, nil); err != nil { return err } + log.Printf("trigger job %s success", v) } return nil