将本地Jenkins安装程序与Azure Dev OPS集成 [英] Integrating Local Jenkins Setup with Azure Dev OPS

查看:72
本文介绍了将本地Jenkins安装程序与Azure Dev OPS集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在以下情况下是否有任何好的文档

我的笔记本电脑上运行着詹金斯大师这个詹金斯大师有几项本地执行的工作

我现在想从Azure Dev Ops调用这些作业.意味着来自Azure云的Devops作业应触发我在本地Jenkins设置上的构建

我看了几个视频,但发现很难绕开它.

仅通过使用插件来连接并执行作业,还有其他更简单的方法吗?

我确实看过一些Udemy视频,但随后进行了许多设置,随着防火墙和路由器设置的使用,确实使您的系统暴露于外部漏洞.

任何帮助将不胜感激.谢谢!

解决方案

您可以为jenkins作业启用 Trigger远程构建,然后在azure devops管道触发您的jenkins管道.请参阅以下步骤:

1,首先,您需要在本地jenkins服务器计算机上创建一个自托管代理.由于jenkins服务器在本地运行,因此需要本地代理才能与本地jenkins服务器通信.请在

3,定义一个秘密变量以在azure devops管道中托管您的jenkins密码:

4,在azure devops管道中添加一个bash任务,以运行以下curl命令:

  #token必须与您在上一步中输入的令牌相同curl -u $ {用户名):$ {密码)http://localhost:8080/job/myproject/build?token = anytoken 

查看此线程

然后,天蓝色的devops职位将触发您本地的jenkin职位.

更新:

您还可以使用 Jenkins队列作业任务在azure devops管道中将jenkin作业排队.请参阅以下步骤:

1,在您的Jenkin服务器中创建一个API令牌.

转到您的jenkin帐户配置页面.创建API令牌.

2,在azure devops管道中添加Jenkins队列作业任务.

3,点击 Manage 链接以创建jenkins服务连接->在新打开的页面->创建服务连接->选择 Jenkins ->下一步

输入所需的信息,如下面的屏幕截图所示.注意:用户名是您在jenkin服务器上的用户帐户,密码是在上一步中生成的 API令牌.

4,如下配置您的Jenkin队列作业任务

I wanted to know if there is any good documentation available for the below scenario

I have a jenkins master running on my laptop This jenkins master have several jobs which executes locally

I now want to call these jobs from Azure Dev Ops. Meaning a Devops job from Azure cloud should trigger a build on my local Jenkins setup

I saw several videos but I am finding it difficult to get around it.

Is there any easier way by just making use of a plugin to connect and executing the job?

I did saw some Udemy videos but then those involve a lot of setting to be done and does expose your system to outside vulnarabilities as firewalls and router settings are played on with.

Any help would be appreciated. Thanks!

解决方案

You can enable Trigger builds remotely for your jenkins jobs, and then use a script task in the azure devops pipeline to trigger your jenkins pipeline. See below steps:

1, Firstly you need to create a self-hosted agent on your local jenkins server machine. Since the jenkins server is running locally, you need a local agent to communicate with your local jenkins server. Follow the steps here to create your local hosted agent.

2, Enable Trigger builds remotely on Jenkins

Go the the Build Triggers Tab of your jenkins pipeline configure page--> Then check Trigger builds remotely--> Specify a Token (will be used in the URL)

3, Define a secret variable to host your jenkins password in azure devops pipeline:

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 

See this thread trigger jenkins job via curl command remotely for more information.

5, Targeting your self-hosted agent pool to run your azure devops pipeline on self-hosted agent.

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.

2, Add Jenkins queue job task in azure devops pipeline.

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.

4, Configure your Jenkin queue job task as below

这篇关于将本地Jenkins安装程序与Azure Dev OPS集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆