Queue Jenkins job on VSTS - azure-devops

The plugin for queuing jobs to Jenkins on VSTS is a very nice integration.
I know there is REST API to queue a build in VSTS.
My question it is possible to queue a Jenkins build with parameters for the parameterized job using the VSTS REST API?

No, they are separate softwares/systems, the VSTS REST APIs are used for VSTS. The Jenkins has it’s own API that you can use it to start a Jenkins build, you can check this article: Remote access API.

Related

Azure Invoke REST Services with VSTS

As I was working on DevOps Integration with mendix for CI/CD Pipeline creation Using Mendix API (Team Server API, Build API, Deploy API).
With this pipeline I have been using Invoke Rest Services task Invoke HTTP REST API task - Azure Pipelines | Microsoft Docs ,Implement a Simple CICD Pipeline with Mendix APIs | Mendix Documentation these are two documents which I have been referred.
I have created Pipelines for that I have added two invoke REST task.
With the below screenshot, in the GET service I could able to get the revision number and all I need to do is dynamically pass in the POST method to the Revision number attribute which was highlighted.
Kindly provide a solution on the below issues.
Thanks in advance!
Get Method for Team Server API for mendix
Post Method for Build API for mendix

How can I trigger an update of Azure DevOps pipeline agent major version by script?

I am trying to automate the update of major version on self-hosted agent, by script. I have searched the docs for Azure DevOps REST API to achive this but no luck. I found a solution online that requires you to reinstall the agent on every machine, which is not what I am after. Anyone have a clue? Is there a way to achieve this through the REST API?
Is there a way to achieve this through the REST API?
The answer is yes.
We could use the REST API Agents - Update to update the version of the agent.
PATCH https://dev.azure.com/{organization}/_apis/distributedtask/pools/{poolId}/agents/{agentId}?api-version=5.1
We do not provide the request body for this REST API.
To get the poolId, we could use the REST API Pools - Get Agent Pools:
GET https://dev.azure.com/{organization}/_apis/distributedtask/pools?api-version=5.1
As the result:

Can I have a Teamcity build triggering an Azure Devops build job?

I'm migrating Teamcity to Azure Devops, as with our on-prem infrastructure. During that period we'll have both Teamcity and Azure Devops deployment for different infrastructures, but we want to reduce the amount of human intervention. So I was thinking in having either Teamcity triggering the Azure Devops build, or vice Versa. I think it would be easier to implement a powershell script that triggers the build on Azure Devops, instead the other way around because of compatibility issues, or version issues(old version).
Yes, you can use Azure Devops api to trigger the build. You would use this api call with appropriate body:
POST https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=5.0
Reading: https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-5.0
I'm not familiar with Azure Devops powershell modules if any, but they might work as well.

Azure Devops Pull Request and Jenkins behind corporate network

I'm trying to figure out how can I connect my Jenkins Build server to the Azure DevOps Pull Request. My Jenkins Server is behind a corporate firewall, I don't have any way to have access to this server outside of the corporate network.
Due to the corporate network rules I cannot add a hook in Azure to call my Jenkins server, but my server can have access to the Microsoft Azure web site.
I tried to run the VSTS Agent with success on my Linux Jenkins server. It works, but It doesn't do what I would need to do. I don't want to change all my build process to build my application inside this Agent. I really want to be able to launch a Jenkins Pipeline build from my server and forward the build result to the Azure DevOps.
I cannot use the Jenkins VM provided by Azure DevOps, because my Jenkins build process has to run some regression test tool on real hardware unit in our lab to flag the build as a success.
So in other word:
1- I cannot use the VSTS agent because I need to use my Jenkins Build Server
2- I cannot use the Jenkins VM provided by Azure DevOps because I need to have access to real Hardware Unite
3- I think I cannot instrument my Jenkins to see if we have a new Pull Request branch, because I will not be able to send the Jenkins build result to the Microsoft Azure DeveOps server.
Anybody had to do something like that?
Any reading to suggest?
Thanks!
Since one-way communication is going to be possible (from Jenkins to Azure DevOps), you'll have to do the following:
Set up your Jenkins pipeline to periodically poll Azure DevOps for new PR branches and build PRs
Set up a branch policy for approval from external services
Have Jenkins post the build status back to the external service API so that Azure DevOps knows whether the build has succeeded or failed

How to remote trigger a Jenkins workflow?

I have troubles with triggering a workflow with both cli and rest api. It tried it in the same way as it works for normal jobs. For the rest api neither build nor buildWithParameters posts work.
Anyone any solutions?
The CLI command is not yet implemented: JENKINS-28071
The REST APIs build and buildWithParameters should work exactly the same as for freestyle projects.