How to remote trigger a Jenkins workflow? - 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.

Related

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:

Promoting a build in jenkins by the rest api

Is there any way of promote a build via the Jenkins REST API ?
If there isn't such a way, is there any way of doing it by code (script, etc.) ?
Thanks for your help!

Queue Jenkins job on VSTS

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.

Team Services - Create issue in Github on failed build

I am using Github as my repo as well as my Kanban/Scrum board. We use Visual Studio Team Services for our automated builds. We really like the way VSTS works and it works well with Github as the repo.
However, I want to be able to create a new Github issue/bug if and when our Continuous Integration build fails. I know you can create a VSTS Work Item but I would rather keep all issues centralized.
Is there any way to hook up VSTS to create a Github repo whenever a build fails? Or perhaps create a Github issue whenever a new VSTS Work Item is created?
We are running our own build server so possibly something can be done on that end?
Yes, you can create a github issue when VSTS build failed with two options.
Option1:
In VSTS build definition, add a powershell task in the end of the build process. Functions in the powershell should include:
Detect above build tasks in the build definition. Use REST API timeline to get build detail, you can find each task result in result parameter.
Determine to create a github issue or not. If all above build tasks are pass to build, don’t create github issue. Else, create a github issue by github API.
Option2:
Create your own website, and in VSTS use web hooks to tigger build fail information for your own website. After your own website receive the build information, it can create a github issue.

GitLab and it's webhook for Build events

I've set up my own GitLab CE server with CI in it. I can already create a webhook to deploy my code to a server just by pushing it. (Many thanks to Matt Jones and his little invention).
However, I still have one issue there. I don't really find a very good description about GitlAbs new feature about Webhook for Build Events. I think I'll need this, since I wish to deploy my code ONLY AFTER a build was succesfull. If I set the webhook for push event, then it has no problem, inmediatly deploys the code. Can any of you provide me with a proper instruction, what do I have to make, to achieve my goal?
Thanks a lot in advance!
I use jenkins for these purposes, you can also set your preferences about when to deploy your code and run pre and post build steps. It's really useful and it has Gitlab integration with the Web hooks.