zoukankan      html  css  js  c++  java
  • Jenkins的初级应用(2)-Invoke Phing targets

        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定义名字的打包文件。

  • 相关阅读:
    vim删除行尾的^M
    apt-get方式安装lnmp环境
    oracle vm virtualbox右ctrl切换显示模式
    chrome(谷歌浏览器)老是提示此文件可能损害计算机
    tmux允许鼠标滚动
    tmux不自动加载配置文件.tmux.conf
    elfutils cc1: all warnings being treated as errors
    Can't locate find.pl in @INC (@INC contains: /etc/perl xxxx) at perlpath.pl line 7.
    help2man: can't get `--help' info from automake-1.15 Try `--no-discard-stderr' if option outputs to stderr Makefile:3687: recipe for target 'doc/automake-1.15.1' failed
    Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/${ <-- HERE ([^ =:+{}]+)}/ at xxxx/usr/bin/automake line 3939.
  • 原文地址:https://www.cnblogs.com/hodge01/p/9367498.html
Copyright © 2011-2022 走看看