logo资料库

Jenkins 2.x Continuous Integration Cookbook.pdf

第1页 / 共616页
第2页 / 共616页
第3页 / 共616页
第4页 / 共616页
第5页 / 共616页
第6页 / 共616页
第7页 / 共616页
第8页 / 共616页
资料共616页,剩余部分请下载后查看
Cover
Copyright
About the Authors
Table of Contents
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Gettings Started with Jenkins
Introduction
Installing Jenkins 2 on Windows
Installing Jenkins 2 on CentOS
Installing Jenkins 2 on Azure
Installing Jenkins as a Service in Windows
Installing plugins in Jenkins
Uploading plugins in Jenkins
Configuring proxy in Jenkins
Configuring global settings in Jenkins
Configuring JENKINS_HOME
Understanding JENKINS_HOME directory
Using different ports for Jenkins
Configuring JAVA_HOME in Jenkins
Configuring Git in Jenkins
Configuring ANT_HOME in Jenkins
Configuring MAVEN_HOME in Jenkins
Configuring GRADLE_HOME in Jenkins
Creating a Freestyle job for Ant Project
Creating a Maven Job for Maven Project
2. Management and Monitoring of Jenkins
Understanding master/agent architecture
Managing Jenkins build jobs using Eclipse
Backing up and restoring Jenkins
Command-line options in Jenkins using Jenkins CLI
Modifying the Jenkins configuration from the command line
Managing disk usage
Shutdown Jenkins safely
Monitoring Jenkins with JavaMelody
Troubleshooting with JavaMelody - memory
Troubleshooting with JavaMelody - painful jobs
Monitoring a Jenkins Job using a Build Monitor View
Configuring mail notifications
Signaling the need to archive
3. Managing Security
Introduction
Improving security with Jenkins configuration
Configuring Authorization - Matrix-based security
Configuring a Project-based Matrix Authorization Strategy
Jenkins and OpenLDAP integration
Jenkins and Active Directory integration
Jenkins and OWASP Zed Attack Proxy integration
Testing for OWASP's top 10 security issues
Finding 500 errors and XSS attachs in Jenkins through fuzzing
Avoiding sign-up bots with JCaptcha
4. Improving Code Quality
Introduction
Integrating Jenkins with SonarQube
The updating center in SonarQube
Quality gates, quality profiles, and rules
Verifying HTML, CSS and JavaScript validity using SonarQube
Verifying Java code using SonarQube
Configuring SonarQube as a Windows service
5. Building Applications in Jenkins
Introduction
Configuring an Ant project for execution
Configuring a Maven project for execution
Configuring an Android project for execution
Manipulating environmental variables
Running Ant through Groovy in Maven
Failed Jenkins jobs based on JSP syntax errors
Different server types
Eclipse templates for JSP pages
Remotely triggering jobs through the Jenkins API
Running jobs from within Maven
Remotely generating jobs
6. Continuous Delivery
Introduction
Archiving artifacts
Copying an artifact from another build job
Integrating Jenkins with Artifactory
Deploying a WAR file from Jenkins to Tomcat
Deploying a WAR file from Jenkins to AWS Beanstalk
Deploying a WAR file from Jenkins to Azure App Services
Promoting builds
7. Continuous Testing
Getting started with continuous testing
Creating a Selenium test case using Eclipse
Integrating Jenkins and Selenium for functional testing
Jenkins and Cucumber test reports
Creating a load test in Apache JMeter
Executing a load test from Jenkins
Reporting JMeter performance metrics
Testing with FitNesse
8. Orchestration
Introduction
Understanding upstream and downstream jobs
Configuring upstream and downstream jobs
Configuring a build pipeline
Creating a pipeline job
Using a sample pipeline for execution
Configuring a pipeline job for end-to-end automation
Getting started with the Blue Ocean dashboard
9. Jenkins UI Customization
Introduction
Skinning Jenkins with the simple themes plugin
CSS 3
Included JavaScript library frameworks
Trust but verify
Skinning and provisioning Jenkins using a WAR overlay
Which types of content can you replace?
Generating a home page
Creating HTML reports
Efficient use of views
Saving screen space with Dashboard View plugin
Making noise with HTML5 browsers
An extreme view of reception areas
10. Processes that Improve Quality
Culture and collaboration
Fail early or fail faster
Data-driven testing
Learning from history
Considering test automation as a software project
Visualize, visualize, and visualize!
Conventions are good
Test frameworks and commericial choices are increasing
Offsetting work to Jenkins nodes
Starving QA/integration servers
Reading the change log of Jenkins
Avoiding human bottlenecks
Avoiding groupthink
Training and community
Visibly rewarding successful developers
Stability and code maintenance
Resources on quality assurance
And there's always more
Final comments
Mitesh Soni, Alan Mark Berg Jenkins 2.x Integration Continuous Cookbook Over 90 practices, recipes techniques, and solutions to produce great results using pro-level [[)] Pacl
Jenkins 2.x Continuous Integration Cookbook Third Edition Over 90 recipes to produce great results using pro-level practices, techniques, and solutions Mitesh Soni Alan Mark Berg BIRMINGHAM - MUMBAI
Jenkins 2.x Continuous Integration Cookbook Third Edition Copyright © 2017 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: June 2012 Second edition: January 2015 Third edition: October 2017 Production reference: 1261017 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78829-794-3 www.packtpub.com
Credits Authors Mitesh Soni Alan Mark Berg Reviewers Juan Vicente Herrera Ruiz de Alejo Javier Delgado Tim Ysewyn Commissioning Editor Vijin Boricha Acquisition Editor Chandan Kumar Content Development Editor Deepti Thore Technical Editor Sneha Hanchate Copy Editors Laxmi Subramanian Safis Editing Project Coordinator Shweta H Birwatkar Proofreader Safis Editing Indexer Tejal Daruwale Soni Graphics Tania Dutta Production Coordinator Deepika Naik
About the Authors Mitesh Soni is an avid learner with 10 years of experience in the IT industry. He is an SCJP, SCWCD, VCP, IBM Urbancode, and IBM Bluemix certified professional and Certified Scrum Master. He loves DevOps and cloud computing and he also has an interest in programming in Java. He finds design patterns fascinating. He believes a picture is worth a thousand words. He occasionally contributes to etutorialsworld.com. He loves to play with kids, fiddle with his camera, and take photographs at Indroda Park. He is addicted to taking pictures without knowing many technical details. He lives in the capital of Mahatma Gandhi's home state. Mitesh has also authored the following books with Packt: Jenkins Essentials, Second Edition DevOps Bootcamp Implementing DevOps with Microsoft Azure DevOps for Web Development Jenkins Essentials Learning Chef "I've missed more than 9,000 shots in my career. I've lost almost 300 games. 26 times, I've been trusted to take the game-winning shot and missed. I've failed over and over and over again in my life. And that is why I succeed." — Michael Jordan. Alan Mark Berg, BSc, MSc, PGCE, has been the lead developer at Central Computer Services at the University of Amsterdam since 1998. He is currently working in an Innovation Work Group that accelerates the creation of new and exciting services. In his famously scarce spare time, he writes. Alan has a bachelor's degree, two master's degrees, a teaching qualification, and quality assurance certifications. He has also coauthored two Packt Publishing books about Sakai (http://sakaiproject.org), a highly successful open source learning management platform used by millions of students around the world. He has won a couple of awards, including the Sakai Fellowship and Teaching With Sakai Innovation Award (TWSIA). Alan enjoys working with talent; this forces him to improve his own competencies. This motivation is why Alan enjoys working in energetic, open source communities of interest. At the time of writing, he is on the board of directors of the Apereo Foundation and is the community offi cer for its Learning Analytics Initiative (https://confluence. sakaiproject.org/display/LAI/Learning+Analytics+Initiative). In previous incarnations, Alan was a QA director, a technical writer, an Internet/Linux course writer, a product line development officer, and a teacher. He likes to get his hands dirty with building, gluing systems, exploring data, and turning it into actionable information. He remains agile by ruining various development and acceptance environments and generally rampaging through the green fields of technological opportunity
About the Reviewers Juan Vicente Herrera Ruiz de Alejo has a degree in computer science. He is the leader of the Madrid DevOps meetup. He is the teacher of DevOps master's program at Alcala de Henares University in Madrid and has been working in IT companies for the past 12 years. He also works as a volunteer at an NGO dedicated to fighting breast cancer. He is currently working for Logtrust.com and has worked for companies such as Colt telecom, Everis, and BBVA. I would like to thank my wife, Emma, and my entire family for all their support. Javier Delgado is an automation fanatic, continuous tasks (inspection, testing, and delivery) evangelist, and perpetual new-knowledge addict. He works as a continuous delivery expert at ING Bank NV.
www.PacktPub.com For support files and downloads related to your book, please visit www.PacktPub.com. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. https://www.packtpub.com/mapt Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content On demand and accessible via a web browser
分享到:
收藏