“Jenkins实现PHP持续集成部署”的版本间的差异
(→phing) |
|||
(未显示同一用户的23个中间版本) | |||
第18行: | 第18行: | ||
Phing 随 PERA 扩展包发布,需要使用 PEAR 包管理程序来安装 | Phing 随 PERA 扩展包发布,需要使用 PEAR 包管理程序来安装 | ||
pear channel-discover pear.phing.info | pear channel-discover pear.phing.info | ||
− | pear install [--alldeps] phing/phing | + | #pear install [--alldeps] phing/phing |
+ | pear install phing/phing | ||
第31行: | 第32行: | ||
</pre> | </pre> | ||
https://www.phing.info/#install | https://www.phing.info/#install | ||
+ | |||
+ | [http://www.cnmiss.cn/?p=279 使用 PHP 的 Phing 项目部署工具] | ||
+ | |||
+ | [https://www.cnblogs.com/RedCandle/archive/2012/06/20/2556585.html 使用 PHP 的 Phing 项目部署工具(转) ] | ||
=jenkins php plugin= | =jenkins php plugin= | ||
+ | 因为 Phing 是基于 Ant 的 | ||
+ | Phing 是一个 PHP 实现的项目构建工具。按照官方文档的说法,你可以用它做任何传统的构建(build/make)工具(比如 Java 的 Ant,GNU Make 等)能做的所有工作。PHP 中比较有名的 framework: Symfony 就用到了 Phing — 顺便提一下,Symfony 中还用到了另外一个 PHP 的轻量级 build 工具: PHP Pake(http://www.pake-project.com/) 。 | ||
+ | |||
+ | Phing是一个PHP项目构建系统或建立一个基于工具的Apache Ant. | ||
+ | |||
+ | 你可以做任何它,你可以做一个传统的构建系统,如GNU make工具,它的使用简单的XML构建文件和可扩展PHP的“任务”类使其易于使用和高度灵活的构建框架. | ||
+ | |||
+ | 其特点包括运行PHPUnit的和SimpleTest的单元测试(包括测试结果和覆盖报告),文件转换(例如令牌替换,XSLT转换,Smarty的模板转换),文件系统操作,互动构建支持,SQL执行,CVS/SVN/GIT操作工具,用于创建PEAR包,文档生成(DocBlox,phpDocumentor)等 | ||
+ | |||
+ | 如果你发现自己编写自定义脚本来处理打包部署,或者您的应用程序的测试,那么我们建议在看Phing.Phing自带打包带大量即装即用的操作模块(任务),以及一个易于使用的面向对象模型来扩展或添加自己的自定义任务. | ||
+ | |||
+ | Phing提供以下功能 | ||
+ | |||
+ | 简单的XML构建文件 | ||
+ | |||
+ | 丰富提供任务 | ||
+ | |||
+ | 通过PHP类易于扩展 | ||
+ | |||
+ | 平台无关:工作在UNIX,Windows,Mac OSX版 | ||
+ | |||
+ | |||
+ | [https://blog.csdn.net/carzyer/article/details/4657550 PHP 实现的项目构建工具:Phing] | ||
+ | |||
+ | [https://blog.csdn.net/zhangking/article/details/6501004 使用 Phing 部署工具] | ||
+ | |||
+ | https://plugins.jenkins.io/phing/ | ||
<pre> | <pre> | ||
Phing plugin | Phing plugin | ||
− | </pre> | + | </pre> |
+ | |||
+ | =过程 = | ||
+ | |||
+ | 最后进入 项目目录 composer install | ||
+ | 会安装很多东西的 最后再去点jenkins jobs | ||
+ | |||
+ | =进阶= | ||
+ | |||
+ | [https://www.php.cn/php-weizijiaocheng-251616.html [LNMP自动化集成<nowiki>]</nowiki>使用jenkins进行PHP持续集成--自动化代码检查、分析和单例测试] | ||
=trouble= | =trouble= | ||
<pre> | <pre> | ||
+ | |||
+ | 问题一 执行jenkins | ||
php artisan migrate --force' | php artisan migrate --force' | ||
PHP Warning: require(/var/package/sns-information/release/804/vendor/autoload.php): failed to open stream: No such file or directory in /var/package/sns-information/release/804/artisan on line 18 | PHP Warning: require(/var/package/sns-information/release/804/vendor/autoload.php): failed to open stream: No such file or directory in /var/package/sns-information/release/804/artisan on line 18 | ||
第59行: | 第102行: | ||
+ | |||
+ | 问题二 | ||
+ | git 没有版本 新开的 git 他们没上版本 丢 | ||
+ | |||
+ | |||
+ | Building on master in workspace /var/jenkins_home/workspace/stage-sns-information | ||
+ | using credential d8b760bf-b0ee-458f-af5a-fade9aaa0d5b | ||
+ | > git rev-parse --is-inside-work-tree # timeout=10 | ||
+ | Fetching changes from the remote Git repository | ||
+ | > git config remote.origin.url http://192.168.10.208:7080/php/sns-information.git # timeout=10 | ||
+ | Fetching upstream changes from http://192.168.10.208:7080/php/sns-information.git | ||
+ | > git --version # timeout=10 | ||
+ | using GIT_ASKPASS to set credentials evan2021 | ||
+ | > git fetch --tags --force --progress -- http://192.168.10.208:7080/php/sns-information.git +refs/heads/*:refs/remotes/origin/* # timeout=10 | ||
+ | > git rev-parse refs/remotes/origin/release^{commit} # timeout=10 | ||
+ | > git rev-parse refs/remotes/origin/origin/release^{commit} # timeout=10 | ||
+ | > git rev-parse origin/release^{commit} # timeout=10 | ||
+ | ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job. | ||
+ | Archiving artifacts | ||
+ | SSH: Current build result is [FAILURE], not going to run. | ||
+ | Finished: FAILURE | ||
+ | |||
+ | |||
+ | 问题三 ssh | ||
+ | |||
+ | |||
+ | 可以了 可能要rsa的才行 jenkins | ||
+ | jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [newjenkins2021]. Message [Auth fail]] | ||
+ | |||
+ | |||
+ | </pre> | ||
+ | |||
+ | ==解决 Laravel/Lumen 出现 "Please provide a valid cache path" 问题 == | ||
+ | <pre> | ||
+ | 进入项目目录 | ||
+ | |||
+ | 创建目录: at jenkins | ||
+ | |||
+ | mkdir -p storage/framework/views | ||
+ | mkdir -p storage/framework/cache | ||
+ | mkdir -p storage/framework/sessions | ||
</pre> | </pre> | ||
+ | |||
+ | [https://www.cnblogs.com/myall/p/6872824.html 解决 Laravel/Lumen 出现 "Please provide a valid cache path" 问题] | ||
+ | =see also= | ||
+ | [https://www.jianshu.com/p/e33b226b25c5 PHP+Jenkins 持续集成 ] | ||
+ | |||
+ | [https://blog.csdn.net/u014477164/article/details/76686286 jenkins 实现PHP持续集成部署] | ||
+ | |||
+ | [https://www.cnblogs.com/phpworld/p/8745544.html jenkins phing build.xml 简单实现php集成上线部署 ] | ||
+ | |||
+ | [https://blog.csdn.net/u014477164/article/details/76686286 jenkins 实现PHP持续集成部署] | ||
+ | |||
+ | [https://www.php.cn/topic/php7/429276.html PHP7中php.ini、php-fpm和www.conf 配置] | ||
+ | |||
+ | [https://www.jianshu.com/p/d979ae1e7e57 使用 Jenkins 自动化发布 PHP 项目] | ||
+ | |||
+ | [https://blog.csdn.net/chennutou1145/article/details/100841271 使用 docker 打包部署 php 应用] | ||
+ | |||
+ | [https://blog.csdn.net/chinabluexfw/article/details/7322832 jenkins,phing,svn,phpunit for ubuntu 整合] | ||
+ | |||
+ | [https://blog.csdn.net/u012795507/article/details/84644958 PHP+Jenkins 持续集成] | ||
+ | |||
+ | [https://anil.io/blog/php/setup-jenkins-php-phing-symfony-phpunit/ Setup Jenkins with PHP, Phing, Symfony & PHPUnit] | ||
+ | |||
+ | |||
+ | [https://blog.csdn.net/ChinaHuanyang/article/details/79457199 接口测试方案之 PHPUnit + Jenkins + Ant] | ||
+ | |||
+ | |||
+ | [https://blog.51cto.com/birdinroom/1346812 基于Jenkins 实现php项目的自动化测试、自动打包和自动部署] | ||
+ | |||
+ | [[category:ops]][[category:devops]] |
2021年9月27日 (一) 02:02的最新版本
目录
jenkins ins
jenkins alpine php env
login into alpine docker apk add php php-pear composer php7-fpm php7-json php7-iconv php7-curl php7-pdo php7-gd php7-fileinfo php7-bcmath php7-dom php7-tokenizer php7-ctype php7-simplexml php7-x mlwriter php7-xmlreader php7-zip php7-session
phing
这个成功的 但是这个 是官方说 deprecated 的 哈哈 Phing 随 PERA 扩展包发布,需要使用 PEAR 包管理程序来安装 pear channel-discover pear.phing.info #pear install [--alldeps] phing/phing pear install phing/phing wget -c https://www.phing.info/get/phing-latest.phar php phing-latest.phar 这个不成功 Class 'Phar' not found in /root/phing-latest.phar:5t
https://www.phing.info/#install
jenkins php plugin
因为 Phing 是基于 Ant 的 Phing 是一个 PHP 实现的项目构建工具。按照官方文档的说法,你可以用它做任何传统的构建(build/make)工具(比如 Java 的 Ant,GNU Make 等)能做的所有工作。PHP 中比较有名的 framework: Symfony 就用到了 Phing — 顺便提一下,Symfony 中还用到了另外一个 PHP 的轻量级 build 工具: PHP Pake(http://www.pake-project.com/) 。
Phing是一个PHP项目构建系统或建立一个基于工具的Apache Ant.
你可以做任何它,你可以做一个传统的构建系统,如GNU make工具,它的使用简单的XML构建文件和可扩展PHP的“任务”类使其易于使用和高度灵活的构建框架.
其特点包括运行PHPUnit的和SimpleTest的单元测试(包括测试结果和覆盖报告),文件转换(例如令牌替换,XSLT转换,Smarty的模板转换),文件系统操作,互动构建支持,SQL执行,CVS/SVN/GIT操作工具,用于创建PEAR包,文档生成(DocBlox,phpDocumentor)等
如果你发现自己编写自定义脚本来处理打包部署,或者您的应用程序的测试,那么我们建议在看Phing.Phing自带打包带大量即装即用的操作模块(任务),以及一个易于使用的面向对象模型来扩展或添加自己的自定义任务.
Phing提供以下功能
简单的XML构建文件
丰富提供任务
通过PHP类易于扩展
平台无关:工作在UNIX,Windows,Mac OSX版
https://plugins.jenkins.io/phing/
Phing plugin
过程
最后进入 项目目录 composer install 会安装很多东西的 最后再去点jenkins jobs
进阶
[LNMP自动化集成]使用jenkins进行PHP持续集成--自动化代码检查、分析和单例测试
trouble
问题一 执行jenkins php artisan migrate --force' PHP Warning: require(/var/package/sns-information/release/804/vendor/autoload.php): failed to open stream: No such file or directory in /var/package/sns-information/release/804/artisan on line 18 PHP Fatal error: require(): Failed opening required '/var/package/sns-information/release/804/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/package/sns-information/release/804/artisan on line 18 SSH: EXEC: completed after 80,843 ms 解决 /var/jenkins_home/workspace/stage-sns-information # composer install 可见要安装的 其实是要激活的 搞错方向了 应该是向上看例如 Problem 1 - Installation request for doctrine/dbal v2.8.0 -> satisfiable by doctrine/dbal[v2.8.0]. - doctrine/dbal v2.8.0 requires ext-pdo * -> the requested PHP extension pdo is missing from your system. resolv apk add php7-pdo 问题二 git 没有版本 新开的 git 他们没上版本 丢 Building on master in workspace /var/jenkins_home/workspace/stage-sns-information using credential d8b760bf-b0ee-458f-af5a-fade9aaa0d5b > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url http://192.168.10.208:7080/php/sns-information.git # timeout=10 Fetching upstream changes from http://192.168.10.208:7080/php/sns-information.git > git --version # timeout=10 using GIT_ASKPASS to set credentials evan2021 > git fetch --tags --force --progress -- http://192.168.10.208:7080/php/sns-information.git +refs/heads/*:refs/remotes/origin/* # timeout=10 > git rev-parse refs/remotes/origin/release^{commit} # timeout=10 > git rev-parse refs/remotes/origin/origin/release^{commit} # timeout=10 > git rev-parse origin/release^{commit} # timeout=10 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job. Archiving artifacts SSH: Current build result is [FAILURE], not going to run. Finished: FAILURE 问题三 ssh 可以了 可能要rsa的才行 jenkins jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [newjenkins2021]. Message [Auth fail]]
解决 Laravel/Lumen 出现 "Please provide a valid cache path" 问题
进入项目目录 创建目录: at jenkins mkdir -p storage/framework/views mkdir -p storage/framework/cache mkdir -p storage/framework/sessions
解决 Laravel/Lumen 出现 "Please provide a valid cache path" 问题
see also
jenkins phing build.xml 简单实现php集成上线部署
PHP7中php.ini、php-fpm和www.conf 配置
jenkins,phing,svn,phpunit for ubuntu 整合
Setup Jenkins with PHP, Phing, Symfony & PHPUnit