Get Jenkins artifacts URl from REST api - rest

Is there any way to get artifacts download url from jenkins REST API. I am using artifact deployer and artifacts can be download from
http://localhost:8080/job/jobname/buildId/deployedartifact/downloads/artifacts.{id}
Is it possible to get the url infomation from REST api??

you mean this?
http://jenkins/job/myjob/../api/json?tree=artifacts[*]
Reference:
Click here

If you're using the ArtifactDeployer Plugin, then, unfortunately, the artifacts deployed through it won't be listed by the API.
The ideal solution, if you have the time for it, would be to mod the plugin and add an API to it.
In my case, due to time constraints, I had to scrape the page instead, by fetching the build's HTML page and picking up all the <a> tags whose href started with "deployedartifact/downloads".

Related

Fetch dependencies from a project in Github using CLI

I would like to know -
Are there any commands for GitHub, allowing me to fetch the dependencies of a project in github?
At Github, under 'Insights' tab, I may look for the dependencies, by pressing the 'Dependencies Graph' button, and that displays all the dependencies for this project.
My qustion is -
Can I write a scrypt, to fetch these dependencies?
I tried to navigate in postam and make a GET request to the url
'https://github.com/-User-/-Project-/network/dependencies'
and I recive an 404 response.
But when I put the same url in chrome, I can see the Dependencies Graph for that project.
You can’t. There are now API calls available for this information at the moment. I’ve been wanting to get that information myself as well 😕.

How to use Bamboo's rest api to download an artifact

I am trying to write a bash script to download an artifact from Bamboo so that it can be used for other operations. I tried following the solution suggested in this post - using bamboo/rest/api/latest/result however I still just get the xml showing the location and the name of the artifact. The artifact itself is not downloaded. Any suggestions on how to go about this?
Below is the api cmd that I am using:
http://myhost.com:8085/bamboo/rest/api/latest/result/{projectKey}-{buildKey} [GET]
After much tweaking I managed to get it to work. I had messed up parsing of the artifact location link extracted from the xml. With the correct link, obtained from the xml, and the right authentication the artifact can be downloaded.

VSTS Get Individual Artifact REST Client API

I have some build artifacts that have some debug information in them that I would like to display in a build summary. However, the only APIs I'm seeing for getting artifacts is as a zip file. If you go to the artifact screen and explore the artifacts, then copy the download URL, you get an API as:
https://{account}/_apis/resources/Containers/{container}?itemPath={file_name}
However, I can't seem to find a REST Client API to utilize this function in my ts script in the extension.
Any thoughts on how to get the actual files from this? The TS script needs to just grab the file and display it in the browser.
There isn’t such REST client API to do it.
You can call that API through HTTP request directly. To get container’s Id, you can use Get build artifacts REST API (in resource > data value).
There is an article about make http request.
5 Ways to Make HTTP Requests in Node.js
On the other hand, you don’t need to do it through extension, just call Logging Command (call command during build/release) to add additional information to build/release summary. (##vso[task.uploadsummary]local file path)

Bamboo REST API access manually overridden variables

No luck over at the Atlassian Q/A board.
I'm trying to access bamboo project build version info via the REST API with the endpoint format:
http://bambooprod01.mysite.com:8085/rest/api/latest/plan/PROD-myproject?expand=variableContext
which returns an outdated version. When I view the information on bamboo I see the correct version of the build under the meta data tab, and above the info fields it states
"The following parameters have been manually overridden."
QUESTION: Is there a way to access the overridden variable info via a REST endpoint and if so what would the path be?
Got a response via Atlassian.
Atlassian Post
Unfortunately, this response has not being implemented and there is an
improvement request filed for that BAM-13511 - Expose the build
variables via the REST API OPEN.

Adding custom status page to Jenkins instance

I want to use the REST API that comes with Jenkins to generate a status page which shows all my projects, the environments they're currently deployed to, latest build versions etc.
Jenkins provides a nice REST API to expose this info however consuming the service is limited by cross domain restrictions. I have looked briefly at creating a CORS filter for my Jenkins instance but its overkill for what I'm trying to achieve.
Can someone tell me if its possible to modify my Jenkins WAR (instance) and add some HTML which i can then modify to call the RESTful endpoints? Ideally i want something whereby i can simply navigate to http://myjenkins/project-status and see the required information.
I assume your status page has some Javascript executing XMLHttpRequests. You could drop your status page files into $JENKINS_HOME/userContent directory on the master. This way they are served by Jenkins and should be able to access Jenkins REST APIs.