'Master Jenkins CI For DevOps and Developers'课程总结 - 2

CI/CD在Jenkins上的简易实现

Build job

在pipeline的最上游的Build job里的Configure里做如下设置,可使该job以1分钟1次的频率,去轮询Git repository里的代码,如果有更新,则即刻开始build。* * * * *表示轮询频率是每一天的每一分钟,这里是用的Cron表达式,具体可见Cron Format

这里写图片描述

Continous Delivery(持续交付),里面当然包含了自动化部署,以Java实现的web app项目为例,部署就需要拿到编译通过并打包好的war包文件,并部署到Tomcat服务器上。

在job Configure -> Build -> Invoke top-level Maven targets里填入 clean package,然后在Post-build Actions里添加Archive the artifacts,填入**/*.war,表示寻找所有war文件并存档到workspace里。

当然Build job里也是可以跑单元测试和做静态代码检查的。

继续在Configure -> Post-build Actions里添加Build other projects,在这里填入下游的staging job的名字。

Staging job

在用来部署staging环境的job里,需要用到Copy Artifact插件,和Deploy to container插件。

Configure->Build里添加Copy artifacts from another project,Artifact to copy里填**/*.war,Post-build Actions里添加Deploy war/ear to a container,Container里选择合适的容器,比如Tomcat 8.x,设置好Credentials和Tomcat URL,保存。顺利的话,至此,启动上游Build job成功后,会拉起这个staging job,会把war包部署到Tomcat里,这时候打开Tomcat下的web app的链接,就能看到运行的web app了,这也意味着可以开始下一步的产品测试,比如接口测试和Selenium实现的Web UI测试。

最后使用Build Pipeline Plugin插件,新建pipeline view,可获得下面的可视化的pipeline效果。

这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Devops, the combination of software development with information technology operations, has been a hot field during the last decade. Traditional boundaries between software development, deployment, maintenance, and quality assurance are broken, enabling more integrated teams. Python has been a popular language both in traditional IT operations and in the DevOps due to its combination of flexibility, power, and ease of use. The Python programming language was created in the early 1990s for use in system administration. It has been a great success in this area and gained wide adoption. It is a general-purpose programming language used in just about every domain. Visual effects and the film world is another prominent Python success story. More recently, it has become the defacto language in data science and machine learning. It has been used across industries from avian to bioinformatics. Modern Python has an extensive arsenal of tools to cover the wide-ranging needs of its users. Learning the whole Python Standard Library (the capabilities that come with any Python installation), would be a daunting task. If you add to it learning all of the third party packages ( that enliven the Python ecosystem, it would be an immense undertaking. The good news is that you don’t need to. You can become a powerful DevOps practitioner with only a small subset of Python. In this chapter, we draw on our decades of Python DevOps experience to teach only the elements of the language that you need. These are the parts of Python you use daily. They form the essential toolbox to get things done. Once you have these core concepts down, you can add more complicated tools, and indeed this is touched in more advanced features in later chapters.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值