环境操作系统: Ubuntu 18.04
jenkins:2.277.4
服务器ip应用192.168.233.17gitlab服务器192.168.233.18Jenkins服务器192.168.233.195被引入为后端nginx服务器的自由样式模型
一、新任务
2 .输入任务名称,选择自由样式选项,然后单击“确定”
3、其中git源代码选择基于ssh私钥的方式认证
4、此处的构建是指Jenkins拉动代码后的后续内容。 例如,向其他服务传递代码或执行服务重新启动。 这里为了简化演示,只复制一个文件。
单击“保存”完成任务的创建
5、目前195后端的nginx页面是这样的。 然后,在gitlab中将页面插入一行test2
root @ Ubuntu 18://good # cat index.html h1 test1/h1 h1 test2/h1 root @ Ubuntu 18://good # gitaddindex.html root gt index.html committer 3360 root root @ Ubuntu 18.04.5-4 yournameandemailaddresswereconfiguredautomaticalllybasedonyourusernammmm nsuppressthismessagebysettingthemexplicitly.runthefollowingcommandandfollowtheinstructions editourconfigurationfile 34 -editafterdoingthis,youmayfixtheidentityusedforthiscommitwith : git commit---amend-- reset-author 1file changed 1 insertion () root@Ubuntu18: )/good# gitpushusernamefor ' http://192.168.233.17 ' : rootpassword for ' http://root @ 192.168.233.17 ' : countingobjectingobjectect 258 bytes | 258.00 KiB/s,done.total3) Delta0),reused0(Delta0) to http://192.168.233.17/root/good.git B3 e29 f
7、进一步访问233.195后,页面上增加了一行test2。
这样就成功部署了自由格式代码
引入拼音模式
Pipline是在Jenkins上运行的一组工作流框架,连接在单一或多个节点上独立运行的任务,实现了单一任务难以完成的复杂的发布过程,实现了单一任务难以实现的复杂的过程编排和任务Pipeline的实现方法是一组Groovy DSL,任何发布过程都可以表示为Groovy脚本。
语法:
Stage:阶段,一个pipline可以分为几个stage,每个stage是操作步骤。
例如,clone代码、代码编译、代码测试和代码部署是可以跨多个节点执行的逻辑组。
Node:节点,每个节点是jenkins节点,jenkins master或jenkins agent,以及节点是执行step的具体服务器。
Step:步骤,step是jenkins pipline的最基本操作单元,通过各种Jenkins插件实现,从在服务器上创建目录到构建容器镜像。 一个stage可以有多个step。 例如sh “make”
一、新任务
2、编写脚本
3、点击构建
4、再添加一行gitlab索引页面: test333
5、访问结果