Invoke Phing targets这个插件主要是读取xml形式包括自动化测试打包部署的配置文件,然后根据流程走下来。用phing命令读取并执行xml配置文件,然后执行定义的步骤。比如check、tar、phpunit操作。
本文用tar这个功能来介绍 Invoke Phing targets 插件,顺便也介绍一下tar这个通用的功能,在我们日常的自动化构建的应用。
一、安装插件
1、通过[系统管理]到[插件管理]到[可选插件]里面查找安装。
二、配置 包括服务器的xml
1、build.xml(放在项目的根目录下面)
<? xml version = "1.0" encoding = "UTF-8" ?>
<project name = "api" default = "build" >
<target name = "build" depends = "make_runtime,phpcs-ci,phploc,pdepend,phpcb,phpunit,phpdox,phpcpd" />
<property name = "version-m" value = "1.1" />
<property name = "version" value = "1.1.0" />
<property name = "stability" value = "stable" />
<property name = "releasenotes" value = "" />
<property name = "tarfile" value = "${phing.project.name}.${buildnumber}.${buildid}.tar.gz" />
<property name = "pkgfile" value = "${phing.project.name}.${version}.tgz" />
<property name = "distfile" value = "dist/${tarfile}" />
<property name = "tests.dir" value = "test" />
<fileset id = "api.tar.gz" dir = "." >
<include name = "test/**" />
<include name = "*.php" />
<include name = "*.xml" />
</fileset>
<target name = "check" description = "Check variables" >
<fail unless = "version" message = "Version not defined!" />
<fail unless = "buildnumber" message = "buildnumber not defined!" />
<fail unless = "buildid" message = "buildid not defined!" />
<delete dir = "dist" failonerror = "false" />
<mkdir dir = "dist" />
</target>
<target name = "tar" depends = "check" description = "Create tar file for release" >
<echo msg = "Creating distribution tar for ${phing.project.name} ${version}" />
<delete file = "${distfile}" failonerror = "false" />
<tar destfile = "${distfile}" compression = "gzip" >
<fileset refid = "api.tar.gz" />
</tar>
</target>
</project>
include表示打包的包含的文件,排除的文件可以用exclude标签。include一定要放在所有的exclude后面。全部文件用[**]表示,文件夹也要表明下面的文件,比如[test/**]。
定义tar动作。
2、控制台配置。
添加构建步骤
配置属性(这里是配置tar操作的例子)
三、立即构建
点击[立即构建],在工作副本目录的根目录就可以生成有build.xml定义的dist目录,和由build.xml定义名字的打包文件。
以上就是Jenkins初级应用之Invoke Phing targets插件配置的详细内容,更多关于Jenkins之Invoke Phing targets配置的资料请关注其它相关文章!
原文链接:https://HdhCmsTestcnblogs测试数据/hodge01/p/9367498.html
查看更多关于Jenkins初级应用之Invoke Phing targets插件配置的详细内容...