Im trying to create a Jenkins job from the terminal
I downloaded the config file of another project without issues
curl -X GET --user <username>:<api-token>/ http://<jenkins-server-address>:<port>/job/<job-name>/config.xml -o mylocalconfig.xml
the to create the job
curl -s -X POST --user <username>:<api-token> 'http://<jenkins-server-address>:<port>/job/createItem?name=<job-name>' --data-binary #mylocalconfig.xml -H "Content-Type:text/xml"
But I'm getting a 404
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404 Not Found</h2>
<table>
<tr><th>URI:</th><td>/job/watchlist-app/job/createItem</td></tr>
<tr><th>STATUS:</th><td>404</td></tr>
<tr><th>MESSAGE:</th><td>Not Found</td></tr>
<tr><th>SERVLET:</th><td>Stapler</td></tr>
</table>
<hr/>Powered by Jetty:// 10.0.11<hr/>
I rember to do in this way a few months ago without issues I don't what's wrong do I missing something?
create a jenkins job from the cli interacting with the jenkins rest api
Related
I am trying to download the logs of a particular workflow in github.
I have referenced the following link for the same.
However I am getting 302 as response code.
Not sure what the issue here is. Its not downloading logs as expected
curl -v -u username:$token -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/ORGANIZATION/REPOSITORY/actions/runs/319282523477/logs
.
.
< HTTP/1.1 302 Found
< Date: Wed, 21 Oct 2020 07:47:13 GMT
< Content-Type: text/html;charset=utf-8
.
As per the same documentation that you mentioned:
Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look for Location: in the response header to find the URL for the download
Response
Status: 302 Found
So you might have already got the url to download the logs as the response has a 302 http status. Please check for the Location: response header, which should give you the url that you need to download the logs.
As a side note to Madhu Bhat's answer, you can simply add -L to your curl command to make it follow redirects.
(from curl --help)
-L, --location Follow redirects
I have a service that is POSTing to an Apache WebDAV endpoint but POST is not a standard implemented method and on WebDAV.
The end goal is to have files uploaded via a POST to create/overwrite a resource the exact same way a PUT method currently works; as when the service does a PUT, the file is successfully created, but on POST, it only works if a file already exists.
E.g:
Successful PUT on new resource
➜ ~ curl -X PUT -k -F 'data=#test_file_upload.txt https://endpoint.tld/put_test.txt
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h1>Created</h1>
<p>Resource /put_test.txt has been created.</p>
</body></html>
Unsuccessful POST on new resource
➜ ~ curl -X POST -k -F 'data=#test_file_upload.txt' https://endpoint.tld/post_test.txt
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /post_test.txt was not found on this server.</p>
</body></html>
I have tried Apache Rewrite but cannot change the method.
I am currently attempting to implement a Python3 Flask script with WSGI and a proxy request on POST; but this is becoming incredibly cumbersome and complicated.
Would using mod_perl allow me to script something without extending to a proxied request?
How can I leverage the lowest friction solution to have this working?
Im trying to read an Atlas entitiy via rest api, i tried this command :
curl -v -i -s -X GET user:pwd#something.confidential.here:21000/v1/entities/branch_intersect
Although i can see the table in Apache UI but it says not found :
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /v1/entities/branch_intersect. Reason:
<pre> Not Found</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>
</body>
</html>
Im using Atlas v 0.7 and following this doc
The rest url should be like this :
curl -v -i -s -X GET user:pwd#something.confidential.here:21000/api/atlas/
Reference here
I have installed Ambari 2.5.0 version with HDP 2.6 and added some of the services but while enabling kerberos I am facing one weird issue.
resource_management.core.exceptions.Fail: Execution of 'curl -sS -L -w '%
{http_code}' -X GET --negotiate -u : 'http://xxxx:50070/webhdfs/v1/ats/done?
op=GETFILESTATUS&user.name=hdfs'' returned status_code=403.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 403
org.apache.hadoop.security.authentication.client.AuthenticationException
</title
</head>
<body><h2>HTTP ERROR 403</h2>
<p>Problem accessing /webhdfs/v1/ats/done. Reason:
<pre>
org.apache.hadoop.security.authentication.client.AuthenticationException
</pre>
</p><hr /><i><small>Powered by Jetty://</small></i><br/>
<br/>
My installation is getting failed while installing the APP time line server.
Any suggestions will be appreciated.
Rundeck supports triggering jobs via their API. The API documentation is available under documentation.
We are using API version 13 which does not yet support application/json. Therefore i need to use the XML based request.
In my previous attempts, i always get the response:
<result error="true" apiversion="13">
<error code="api.error.job.options-invalid">
<message>Job options were not valid: Option 'container' is required. Option 'version' is required.
</message>
</error>
</result>
Since there is no example request provided, i am searching for an example payload to trigger the job.
As seen in the response i have to provide the parameters "container" and "version" since they are required.
My most recent request payload was:
<executeJob>
<argString>-container containerName -version 1234567</argString>
</executeJob>
I also tried different variations of this payload, every time with the same response.
This should help you, assuming you have a token to access Rundeck with authorization to run the job
curl -D - -X "POST" -H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Rundeck-Auth-Token: <TOKEN>" \
-d '{"argString":"-arg1 val1 -arg2 val2"}' \
http://<URL>/api/16/job/<JOB_ID>/executions