Вы можете включить триггерные сборки удаленно для ваших заданий jenkins, а затем использовать задачу script в конвейере azure DevOps для запуска вашего конвейера jenkins. См. Шаги ниже:
1. Во-первых, вам нужно создать собственный агент на вашем локальном сервере jenkins. Поскольку сервер jenkins работает локально, вам нужен локальный агент для связи с вашим локальным сервером jenkins. Следуйте инструкциям здесь , чтобы создать локальный размещенный агент.
2, Включить Триггер создает удаленно на Jenkins
Go the Триггеры сборки Вкладка конвейера Дженкинса страница настройки -> Затем отметьте Триггеры собираются удаленно -> Укажите Токен (будет использоваться в URL-адрес) ![enter image description here](https://i.stack.imgur.com/VrzwZ.png)
3, Define a secret variable to host your jenkins password in azure devops pipeline:
![enter image description here](https://i.stack.imgur.com/0yiDG.png)
4, Add a bash task in your azure devops pipeline to run the below curl command:
#token must be the same with the token you entered in above step
curl -u $(username):$(password) http://localhost:8080/job/myproject/build?token=anytoken
![enter image description here](https://i.stack.imgur.com/jdbt5.png)
See this thread запускать задание Дженкинса удаленно с помощью команды curl для получения дополнительной информации.
5, Таргетинг вашего пула агентов на собственном хостинге для запуска вашего azure DevOps pipeline на собственном агенте.
![enter image description here](https://i.stack.imgur.com/tcnPP.png)
Then your local jenkin jobs will be triggered by the azure devops jobs.
Update:
You can also use Jenkins queue job task to queue a jenkin job in azure devops pipeline. See below steps:
1, Create a API Token in your Jenkin server.
Go your jenkin account configure page. To create a API token.
![enter image description here](https://i.stack.imgur.com/BweBy.png)
2, Add Jenkins queue job task in azure devops pipeline.
![enter image description here](https://i.stack.imgur.com/c2ctQ.png)
3, Click the Manage link to create a jenkins service connection--> In the newly opened page-->Create Service connection-->Select Jenkins--> Next
Enter the required information as below screenshot. Note: username is your user account for jenkin server, the Password is the API Token You generated in above step.
![enter image description here](https://i.stack.imgur.com/9eFfm.png)
4, Configure your Jenkin queue job task as below
введите описание изображения здесь