触发“执行Maven发布"詹金斯工作从另一个工作 [英] Trigger "perform maven release" of a jenkins job from another job

查看:97
本文介绍了触发“执行Maven发布"詹金斯工作从另一个工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

寻找从另一个詹金斯工作中触发执行maven"发布工作的方法.它可以是rest api(或可以执行此操作的插件).我看到了有关触发参数化"插件的帖子,可以做到这一点,但我看不到做到这一点的方法.因此,我需要有关如何尝试的真实示例.

Looking for ways to trigger a "perform maven" release job from another jenkins job. It can be a rest api (or) a plugin that can do it. I saw posts about "trigger paramterized" plugin which can do this, but I cant see a way to do it . So I need real examples on how to try it.

谢谢!

推荐答案

任务已在詹金(Jenkin)的吉拉(Jira)开放,目前尚无动静.

This task has been open in Jenkin's Jira since July 2015 with no movement yet.

既然是这种情况,我建议使用 HTTP POST 完成此任务.为此,您需要执行以下操作:

Since this is the case, I suggest using an HTTP POST to accomplish this task. To do this, you will need to do the following:

  1. 安装 HTTP请求插件
  2. 使用适当的
  3. Jenkins -> 管理Jenkins -> 配置系统-> HTTP请求-> 基本/摘要身份验证-> 添加->使用来自 第2步 的信息创建全局HTTP身份验证密钥
  4. 创建一个父"作业,该作业将通过
  1. Install the HTTP Request Plugin
  2. Create an httpUser (or use an existing one) with the appropriate
  3. Jenkins -> Manage Jenkins -> Configure System -> HTTP Request -> Basic/Digest Authentication -> Add -> create a Global HTTP Authentication Key with the information from step 2
  4. Create a "parent" job that will trigger other Jenkins job(s) via the M2-Release-Plugin and configure it as follows:
  5. This build is parameterized
    • releaseVersion (Text Parameter)
    • developmentVersion (Text Parameter)
    • (add other parameters as required, look in the doSubmit method for details)
  • URL (应具有此格式)= http:// JenkinsServerName /job/ JenkinsJobName /m2release/submit
  • HTTP模式 = POST
  • 高级...
  • 授权-> 身份验证 =选择在 第3步
  • 中创建的身份验证"选项
  • 标题-> 自定义标题-> 添加
  • 标题 =内容类型
  • = application/x-www-form-urlencoded
  • 正文-> 将构建参数传递到URL吗? =是
  • 请求正文 =(您的第5步中的参数和一个json参数对象,并需要其他任何参数)
  • 控制台中的响应正文? =是
  • URL (should have this format) = http://JenkinsServerName/job/JenkinsJobName/m2release/submit
  • HTTP mode = POST
  • Advanced...
  • Authorization -> Authenticate = select the Authenticate option created in step 3
  • Headers -> Custom headers -> Add
  • Header = Content-type
  • Value = application/x-www-form-urlencoded
  • Body -> Pass build params to URL? = Yes
  • Request body = (your parameters from step 5 and a json parameter object with any additional parameters required)
  • Response body in console? = Yes

这些是我执行的使Jenkins作业触发我环境中另一作业的M2释放的步骤.希望这对其他人有帮助,如果我失去笔记或记忆,我也可以参考这篇文章.

These are the steps I followed to have one Jenkins job trigger an m2release on another job in my environment. Hopefully this helps others and should I lose my notes or memory, I can refer to this post as well.

这篇关于触发“执行Maven发布"詹金斯工作从另一个工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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