简体   繁体   English

如何执行shell作为后构建操作?

[英]How to execute shell as post-build action?

I'm using Jenkins CI and I would like to add some post-build actions. 我正在使用Jenkins CI,我想添加一些后期构建操作。

I've tried to follow suggestions from Execute Shell Script after post build in Jenkins post, but I cannot find such option ( Post build task ) which should allow me to execute shell commands. 我试图在Jenkins帖子中的post build之后遵循Execute Shell Script中的建议,但我找不到应该允许我执行shell命令的选项( Post build task )。 I can select Execute shell , but only for Build . 我可以选择Execute shell ,但仅适用于Build

Here are my all options: 以下是我的所有选择:

Jenkins  - 添加构建后操作

Transcript: 成绩单:

Add post-build action: 添加构建后操作:

  • Aggregate downstream test results 汇总下游测试结果
  • Archive the artifacts 存档工件
  • Build other projects 建立其他项目
  • Console output (build log) parsing 控制台输出(构建日志)解析
  • GitHub PR: add labels GitHub PR:添加标签
  • GitHub PR: close PR GitHub PR:关闭PR
  • GitHub PR: post comment GitHub PR:发表评论
  • GitHub PR: remove labels GitHub PR:删除标签
  • GitHub PR: set PR status GitHub PR:设置PR状态
  • Publish HTML reports 发布HTML报告
  • Publish JUnit test result report 发布JUnit测试结果报告
  • Publish Javadoc 发布Javadoc
  • Record fingerprints of files to track usage 记录文件的指纹以跟踪使用情况
  • Use publishers from another project 使用其他项目的发布者
  • Git Publisher Git Publisher
  • Build other projects (manual step) 建立其他项目(手动步骤)
  • E-mail Notification 电子邮件通知
  • Editable Email Notification 可编辑的电子邮件通知
  • Set build status on GitHub commit [deprecated] 在GitHub提交上设置构建状态[不建议使用]
  • Set status for GitHub commit [universal] 设置GitHub commit [universal]的状态
  • Trigger parameterized build on other projects 触发参数化其他项目的构建
  • Delete workspace when build is done 构建完成后删除工作区

What am I missing? 我错过了什么?


Basically I need this to destroy my VM instance in case of provisioning error (eg vagrant destroy -f ). 基本上我需要这个来在销售错误的情况下销毁我的VM实例(例如vagrant destroy -f )。

I'm using Jenkins ver. 我正在使用Jenkins ver。 2.7.1. 2.7.1。

Use the Add post-build action button and select Post build task , which is provided by the mentioned Post build task plugin: 使用Add post-build action按钮并选择Post build task ,它由提到的Post构建任务插件提供:

在此输入图像描述

Afterwards, you have Tasks, each with an input field Script , where you can execute your commands: 之后,您将拥有任务,每个任务都有一个输入字段脚本 ,您可以在其中执行命令:

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM