将 Jenkins 与 Gitlab 集成 [英] Integrating Jenkins with Gitlab

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

问题描述

我需要在 Jenkins 中设置构建配置,以便每当触发构建时,我都会从 Gitlab 获取我的最新脚本并将它们复制到目标系统并在目标上运行该脚本.

I need to setup a build configuration in Jenkins so that whenever a build is triggered, I get my latest scripts from Gitlab and copy them to the target systems and run that script on the target.

我找不到任何将 Gitlab 集成到 Jenkins 的相关信息.有没有我可以使用的特定插件?

I couldn't find any relevant info for integrating Gitlab to Jenkins. Are there any specific plugins that I could use?

我使用的是 Jenkins 2.158 版

I am using Jenkins version 2.158

推荐答案

Git Repository Management(github、gitlab、bitbucket等)与Jenkins的集成有以下几点步骤:

Integration between Git Repository Management (github, gitlab,bitbucket, etc) and Jenkins has the following steps :

  • 开发者将一些源代码(java、php、nodejs 等)推送到 Git Repository Management.
  • Git 存储库管理检测到此事件并通知 到 Jenkins 中的某个 public http 端点.目前,webhook 是实现此通知的最推荐方式.
  • Jenkins 收到 http post 请求(例如来自 bitbucket)并使用一些插件或配置,Jenkins 尝试确定或获取基本的 devops 参数,例如:分支名称、提交作者、提交消息、技术等
  • 利用提取的 devops 参数,Jenkins 启动一个预配置的作业.此作业使用之前提取的值来构建、编译、压缩、安装或执行启动应用程序所需的任何操作.
  • Developer push some source code (java, php, nodejs, etc) to the Git Repository Management.
  • The Git Repository Management detects this event and notify to some public http endpoint in your Jenkins. Currently webhook is the most recommended way to implement this notification.
  • Jenkins receive the http post request(from bitbucket for example) and using some plugin or configurations , Jenkins try to determine or get the basic devops parameters like : branch name, commit author, commit message, technology, etc
  • Whit the extracted devops parameters, Jenkins launchs a preconfigured job. This job use the previously extracted values to build, compile, zip, install or to do whatever is necessary to startup your application.

如果您想实现此流程,请查看此帖子:

If you want to implement this flow, check this post:

https://jrichardsz.github.io/devops/devops-with-git-and-jenkins-using-webhooks

另外,如果您需要.我很乐意向您展示使用一些 git 存储库管理和 jenkins 的基本集成.只要联系我.

Also, if you need. I will gladly to show you a basic integration using some git repository management and jenkins . Just contact me.

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

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