Hi,
I've been creating items (posting jobs) to a view in Jenkins 1.x with security turned off for development only. I've matched the same configuration with a Jenkins 2.3 host. I'm getting an odd failure with only the higher version of Jenkins.
I'm looking for help/suggestions to get past this issue and be able to run my automation code against Jenkins 2.x.
Thanks,
Alex Ellis
* Jenkins 1.x accepts post to both of these endpoints:
/view/<view_name>/createItem?name=
/createItem?name=
* Jenkins 2.x gives an error about needing a form post when I try to create a job inside a view, but when I create a job at the root level it's fine:
/view/<view_name>/createItem?name= (fails)
Error:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 400 This page expects a form submission</title>
</head>
<body><h2>HTTP ERROR 400</h2>
<p>Problem accessing /view/viewnamehere/createItem. Reason:
<pre> This page expects a form submission</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>
</body>
</html>
I'm using a Golang HTTP request from the standard library to perform the post:
response, err := http.Post(urlTotal, "application/xml", reader)
if err != nil {
log.Println(err)
}
out, _ := ioutil.ReadAll(response.Body)
fmt.Println(string(out))
fmt.Printf("[createJob] Status code: %d\n", response.StatusCode)
defer response.Body.Close()