TFS build step - Execute POST web request - tfs

I need to create a step in our TFS build process that will fire off a POST request using basic auth.
How can I execute a POST web request using a TFS build step? Do I need to run a PowerShell script or is there another way?
I would prefer not using PowerShell if possible due to permission restrictions on our build server.
Thank you!

Add an Agentless phase to your build and use the Invoke REST API task.

Related

Jenkins call http api after a build has completed

Context
I use poll policy to get the result of a build. But I want jenkins automatically push the result to me.
How to configure a job to call a http api after its build has completed?
For example, after a build has completed, jenkins call https://{myserver}/api/v1/jenkinsPostBuildCallback?jobName=name&buildNumber=1&result=Failed
Current Attempt
I want to achieve this using jenkins plugins, but I find no plugin that meet my requirement.
Maybe I should develop a custom jenkins plugin?
In the post build select execute shell command and add a curl command to call your http api.

Get build steps using Jenkins Pipeline REST API

I would like to ask is there any way to query run time build steps by using Jenkins pipeline REST API? I refer to this link https://github.com/jenkinsci/pipeline-stage-view-plugin/tree/master/rest-api and it seems like I can't get a run time build steps command line that I configure for Jenkins pipeline job.
Any suggestions?
It seems there is no possibility to get this information via the REST API. I found a solution somewhere.
With
http://Serverurl/job/jobname/config.xml
you can download the config file and parse the XML. Doing it with PowerShell and it's working fine.

JIRA issue on jenkins job failure

I want to integrate Jenkins with jira so that, as soon as a build fails an issue is created in jira. I have already tried jira create issue in jenkins but its not creating any issue
Look at this question: Execute Shell Script after post build in Jenkins
The accepted answer by #Daniel Magnussen refers to http://wiki.hudson-ci.org/display/HUDSON/Post+build+task This is what you need as well
When the build fails, just send a curl request to jira's rest api to create a new issue. Here is some info on how to create the issue with curl:
https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-create-issue

Can Jenkins detect when a new build is available on a Bamboo server?

Can Jenkins detect when a new build is available on a Bamboo server?
What I want is to create a Jenkins job that checks a Bamboo server for a new build. I want this job to run once per hour.
Then, other tests that I have on that Jenkins server will rely on that check passing in order for them to kick off.
If this is possible, what is the usual way of doing this? The Bamboo server is internal and does not need authentication to see status of builds or get build resources.
If there is no plugin for this, I do see a RSS feed at this URI: /rss/createAllBuildsRssFeed.action?feedType=rssAll&buildKey=RELEASE . What method would other Jenkins administrators use to read this feed?
I figured out the answer myself. I wrote a Gradle unit test to run in Jenkins that can read the RSS feed in Bamboo.
The real way to do it though, which didn't answer my question, is to add a post-build hook to either Subverison or Bamboo to send a HTTP get request to Jenkins, which notifies a job to run.

how to use Jenkins apiToken for build api

Could someone please elaborate on how to use jenkins apiToken for build through rest api.
I want to use user based authentication for Jenkins build.
So I have that apiToken with me but when I am trying to build a job I am getting forbidden exception.
I have followed the below url for build a job.
https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients
There is a project called Python Jenkins that provides the wrapper around the Jenkins REST API. I believe you may find a sample of using the authenticated build invocation there. You may find it here

Resources