Jenkins发布PHP项目之一自动化部署( 二 )
命令简单说明:因为这个是在root下执行的 , 所以需要配置root用户的免密登陆
将Jenkins 的root用户的id_rsa.pub放到
cat /root/.ssh/id_rsa.pub >> /home/www/.ssh/authorized_keys
源目录删除的文件 , 目标文件也要删除 , 加--delete参数 --deletedelete extraneous files from destination dirs--progressshow progress during transferrsync -raz --delete --progress * www@10.211.55.3:/home/www
配置中如下填写
文章插图
再次构建,控制台输出
Started by user adminRunning as SYSTEMBuilding in workspace /var/lib/jenkins/workspace/php-deployThe recommended git tool is: NONEusing credential 73d0c28a-8320-4393-86eb-2b60472899a1 > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository > /usr/bin/git config remote.origin.url git@10.211.55.3:/home/git/repos/app.git # timeout=10Fetching upstream changes from git@10.211.55.3:/home/git/repos/app.git > /usr/bin/git --version # timeout=10 > git --version # 'git version 1.8.3.1'using GIT_SSH to set credentials> /usr/bin/git fetch --tags --progress git@10.211.55.3:/home/git/repos/app.git +refs/heads/*:refs/remotes/origin/* # timeout=10 > /usr/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10Checking out Revision 8d2821c2b9e4ac77d758ba2ca6ad87bc9a7e709a (refs/remotes/origin/master) > /usr/bin/git config core.sparsecheckout # timeout=10 > /usr/bin/git checkout -f 8d2821c2b9e4ac77d758ba2ca6ad87bc9a7e709a # timeout=10Commit message: "add php file" > /usr/bin/git rev-list --no-walk 8d2821c2b9e4ac77d758ba2ca6ad87bc9a7e709a # timeout=10[php-deploy] $ /bin/sh -xe /tmp/jenkins5178794915886016847.sh+ rsync -raz --delete --progress index2.html index3.html index.html phpinfo.php www@10.211.55.3:/home/www/______(o o)(o o) (V) ALex CentOS (V)--m-m-----------------m-m--sending incremental file listFinished: SUCCESS
登录到PHP服务器 , 可以看到文件已经存在了
【Jenkins发布PHP项目之一自动化部署】$ pwd/home/www$ lsindex2.htmlindex3.htmlindex.htmlphpinfo.php
推荐阅读
- LG发布LG UltraFine OLED Pro显示器 首次引入OLED面板
- Kensington发布StudioDock 将iPad Pro扩展坞与无线充电器相结合
- 金士顿发布Workflow Station - 为内容创作者设计的模块化底座
- 微软新Surface Pro 7 Plus发布 拥有更大的电池、可拆卸的SSD和LTE模组
- 三星公司发布2021款数字座舱 集成诸多高科技
- 搭载骁龙888处理器+120W超充 横屏性能旗舰iQOO 7正式发布
- 499元!魅族新耳机正式发布:这外观太熟悉了
- 3798元起!iQOO 7正式发布:120W快充+骁龙888
- iQOO 7手机发布:首款120W快充骁龙888旗舰、120Hz全感触控
- “性能旗舰”iQOO 7正式发布:感受全感操控3798元起