VSTS Get Individual Artifact REST Client API - rest

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)

Related

Retrieve a downloadTicket for an artifact in VSTS

I am trying to obtain a "publicly accessible" link for the artifact produced during the build process. The API does reference something called a downloadTicket but the API call doesn't seem to return anything related. I understand that the download would need to provide the downloadTicket through a header, but for now, my question is:
What call do I need to make, either through the REST API or within a
build task itself, to get the artifact information, including the
downloadTicket?
Or option two, is there something else I can to avoid uploading
the file to Azure blob, etc.?
Why do you have to retrieve the downloadTicket?
If you just want to download the artifacts you can use the REST API - Artifacts - Get to retrieve the downloadUrl, then you can share and use that URL to download the specific artifact. (Pleas note that the users need the correct permission to view/download build artifacts)
"downloadUrl": "https://{account}.visualstudio.com/{project}/_apis/build/builds/235/artifacts?artifactName=drop&api-version=5.0-preview.3&%24format=zip"
If you want to download the artifacts in build/release process, then you can use Download Build Artifacts task.
For your option 2, you can create a share location then select a file share as the Artifact publish location and specify the share location. Thus the artifacts will be published to the shared folder... You can set the share folder to "publicly accessible"...

Unity Cloud Build link with Continuous Integration systems

After a successful build in Unity Cloud Build I would like to send the generated .zip file url to a Continuous Integration system like Travis CI in order to to deploy that file into another server. To do this right now I need to call a custom webhook in my own server that checks (via API) the last build link and starts a Travis CI build via HTTP POST method.
What's the best approach to do this without needing my intermediate step? I'have tried to do this HTTP POST request inside the post-script method in Unity Cloud Build but this seems to be a bad workaround.

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.

Get Jenkins artifacts URl from REST api

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".