Jenkins 2: Up and Running. Evolve Your Deployment Pipeline for Next Generation Automation - Helion
ISBN: 978-14-919-7954-9
stron: 606, Format: ebook
Data wydania: 2018-05-02
Księgarnia: Helion
Cena książki: 194,65 zł (poprzednio: 226,34 zł)
Oszczędzasz: 14% (-31,69 zł)
Design, implement, and execute continuous delivery pipelines with a level of flexibility, control, and ease of maintenance that was not possible with Jenkins before. With this practical book, build administrators, developers, testers, and other professionals will learn how the features in Jenkins 2 let you define pipelines as code, leverage integration with other key technologies, and create automated, reliable pipelines to simplify and accelerate your DevOps environments.
Author Brent Laster shows you how Jenkins 2 is significantly different from the more traditional, web-only versions of this popular open source automation platform. If you’re familiar with Jenkins and want to take advantage of the new technologies to transform your legacy pipelines or build new modern, automated continuous delivery environments, this is your book.
- Create continuous delivery pipelines as code with the Jenkins domain-specific language
- Get practical guidance on how to migrate existing jobs and pipelines
- Harness best practices and new methods for controlling access and security
- Explore the structure, implementation, and use of shared pipeline libraries
- Learn the differences between declarative syntax and scripted syntax
- Leverage new and existing project types in Jenkins
- Understand and use the new Blue Ocean graphical interface
- Take advantage of the capabilities of the underlying OS in your pipeline
- Integrate analysis tools, artifact management, and containers
Osoby które kupowały "Jenkins 2: Up and Running. Evolve Your Deployment Pipeline for Next Generation Automation", wybierały także:
- JavaScript. Kurs video. Programowanie funkcyjne i reaktywne 99,00 zł, (29,70 zł -70%)
- Zostań programistą. Kurs video. Fundamentalne zasady i koncepcje programistyczne 79,00 zł, (23,70 zł -70%)
- F# 4.0 dla zaawansowanych. Wydanie IV 96,45 zł, (29,90 zł -69%)
- Systemy reaktywne. Wzorce projektowe i ich stosowanie 65,31 zł, (20,90 zł -68%)
- Scratch. Komiksowa przygoda z programowaniem 36,06 zł, (11,90 zł -67%)
Spis treści
Jenkins 2: Up and Running. Evolve Your Deployment Pipeline for Next Generation Automation eBook -- spis treści
- Foreword
- Preface
- How to Use This Book
- Conventions Used in This Book
- Using Code Examples
- OReilly Safari
- How to Contact Us
- Acknowledgments
- 1. Introducing Jenkins 2
- What Is Jenkins 2?
- The Jenkinsfile
- Declarative Pipelines
- Blue Ocean Interface
- New Job Types in Jenkins 2
- Pipeline
- Folder
- Organization
- Multibranch Pipeline
- Reasons for the Shift
- DevOps Movement
- Assembling Pipelines
- Resumability
- Configurability
- Sharing Workspaces
- Specialized Knowledge
- Access to Logic
- Pipeline Source Management
- Competition
- Meeting the Challenges
- Compatibility
- Pipeline Compatibility
- Plugin Compatibility
- Surviving restarts
- Providing scriptable APIs
- Checking Compatibility
- Summary
- What Is Jenkins 2?
- 2. The Foundations
- Syntax: Scripted Pipelines Versus Declarative Pipelines
- Choosing Between Scripted and Declarative Syntax
- Systems: Masters, Nodes, Agents, and Executors
- Master
- Node
- Agent
- Executor
- Creating Nodes
- A quick note about node labels
- Structure: Working with the Jenkins DSL
- node
- stage
- steps
- Understanding step syntax
- Supporting Environment: Developing a Pipeline Script
- Starting a Pipeline Project
- The Editor
- Working with the Snippet Generator
- Running a Pipeline
- Viewing logs
- Stage View with errors
- Replay
- Summary
- Syntax: Scripted Pipelines Versus Declarative Pipelines
- 3. Pipeline Execution Flow
- Triggering Jobs
- Build After Other Projects Are Built
- Build Periodically
- Cron syntax
- GitHub Hook Trigger for GitSCM Polling
- Poll SCM
- Quiet Period
- Trigger Builds Remotely
- User Input
- input
- Parameters
- Boolean
- Choice
- Credentials
- File
- List Subversion tags
- Multiline String
- Password
- Run
- String
- Return Values from Multiple Input Parameters
- Parameters and Declarative Pipelines
- Using the parameters section
- Using the Jenkins application to parameterize the build
- Using a script block
- Using external code
- Flow Control Options
- timeout
- retry
- sleep
- waitUntil
- Dealing with Concurrency
- Locking Resources with the lock Step
- Controlling Concurrent Builds with Milestones
- Restricting Concurrency in Multibranch Pipelines
- Running Tasks in Parallel
- Traditional parallel syntax
- stash and unstash
- Alternative parallel syntax for Declarative Pipelines
- parallel and failFast
- Conditional Execution
- Post-Processing
- Scripted Pipelines Post-Processing
- try-catch-finally
- catchError
- Declarative Pipelines and Post-Processing
- Scripted Pipelines Post-Processing
- Summary
- Triggering Jobs
- 4. Notifications and Reports
- Notifications
- Email
- Jenkins Location
- E-mail Notification
- Sending email in pipelines
- Extended email notifications
- Global configuration
- Content
- Recipients
- Triggers
- Including logs
- Collaboration Services
- Slack notifications
- Setup in Slack
- Global configuration in Jenkins
- Webhooks in Slack
- Sending Slack notifications in a job
- HipChat notifications
- Setup in HipChat for version 1 API use
- Setup in HipChat for version 2 API use
- Global configuration in Jenkins
- Default notifications
- Sending HipChat notifications in a job
- Slack notifications
- Email
- Reports
- Publishing HTML Reports
- Summary
- Notifications
- 5. Access and Security
- Securing Jenkins
- Enabling Security
- Access ControlSecurity Realm
- Delegate to servlet container
- Jenkins own user database
- LDAP
- Unix user/group database
- Access ControlAuthorization
- Anyone can do anything
- Legacy mode
- Logged-in users can do anything
- Matrix-based security
- Project-based matrix authorization strategy
- Access ControlSecurity Realm
- Other Global Security Settings
- Markup formatter
- Agents
- Prevent Cross-Site Request Forgery exploits
- CLI
- Plugin manager
- Hidden security warnings
- SSH server
- Enabling Security
- Credentials in Jenkins
- Credential Scopes
- Credential Domains
- Credential Providers
- Credential Stores
- Administering Credentials
- Selecting Credential Providers
- Selecting Credential Types
- Specifying Credential Types by Provider
- Creating and Managing Credentials
- Context Links
- Adding a New Domain and Credential
- Using the New Domain and Credential
- Advanced Credentials: Role-Based Access
- Basic Use
- Manage Roles
- Global role example
- Project example
- Slave role example
- Assign Roles
- Dealing with invalid users
- Verifying the roles setup
- Role Strategy Macros
- Working with Credentials in the Pipeline
- Username and Password
- SSH Keys
- Token Credentials
- Controlling Script Security
- Script Checking
- Script Approval
- Groovy Sandboxing
- Using Jenkins Credentials with Vault
- Approach
- Setup
- Creating a Policy
- Authentication
- AppRole
- Using Vault in Jenkins
- Jenkins credentials for Vault
- Using Vault in a Pipeline
- Summary
- Securing Jenkins
- 6. Extending Your Pipeline
- Trusted Versus Untrusted Libraries
- Internal Versus External Libraries
- Internal Libraries
- SSH access
- HTTP access
- External Libraries
- Internal Libraries
- Getting a Library from the Source Repository
- Modern SCM
- Legacy SCM
- Using Libraries in Your Pipeline Script
- Automatic Downloading of Libraries from Source Control
- Loading Libraries into Your Script
- The @Library annotation
- The library step
- The libraries directive
- Library Scope Within Jenkins Items
- Library Structure
- Sample Library Routine
- Structure of Shared Library Code
- src
- vars
- Automatic documentation references for global variables
- Using global variables like steps
- resources
- Structure of Shared Library Code
- Using Third-Party Libraries
- Loading Code Directly
- Loading Code from an External SCM
- Replaying External Code and Libraries
- A Closer Look at Trusted Versus Untrusted Code
- Summary
- 7. Declarative Pipelines
- Motivation
- Not Intuitive
- Getting Groovy
- Additional Assembly Required
- The Structure
- Block
- Section
- Directives
- Steps
- Conditionals
- The Building Blocks
- pipeline
- agent
- Labels and custom workspaces
- Agents and Docker
- Using the same node for Docker and non-Docker stages
- environment
- Credentials and environment variables
- tools
- options
- Options summary
- triggers
- Cron syntax
- parameters
- Using parameters in a pipeline
- libraries
- stages
- stage
- steps
- Conditional execution of a stage
- Conditional execution with and, or, not
- post
- Dealing with Nondeclarative Code
- Check Your Plugins
- Create a Shared Library
- Place Code Outside of the Pipeline Block
- The script Statement
- Using parallel in a Stage
- Script Checking and Error Reporting
- Declarative Pipelines and the Blue Ocean Interface
- Summary
- Motivation
- 8. Understanding Project Types
- Common Project Options
- General
- Discard old builds
- Discarding builds in pipeline projects
- GitHub project
- Specifying the GitHub project property in pipeline projects
- This project is parameterized
- Throttle builds
- Throttling builds in pipelines
- Disable this project
- Disabling Pipeline projects
- Execute concurrent builds if necessary
- Concurrent builds in pipelines
- Restrict where this project can be run
- Pipelines and nodes
- Quiet period
- Pipelines and the quiet period
- Retry count
- Pipelines and retry count
- Block build when upstream project is building
- Block build when downstream project is building
- Waiting for downstream in pipelines
- Use custom workspace
- Custom workspaces and pipelines
- Display name
- Display name and pipelines
- Keep the build logs of dependencies
- Discard old builds
- Source Code Management
- Repository URL
- Credentials
- Revision
- Source code management in a pipeline
- Build Triggers
- Trigger builds remotely
- Remotely triggering pipeline builds
- Building after other projects are built
- Build after other projects in a pipeline
- Build periodically
- Building periodically in a pipeline
- GitHub hook trigger for Git polling
- GitHub triggering in a pipeline
- Poll SCM
- Polling in the pipeline
- Trigger builds remotely
- Build Environment
- Delete workspace before build starts
- Deleting workspaces in a pipeline
- Provide configuration files
- Managing configuration files in a pipeline
- Abort the build if its stuck
- Timing out builds in a pipeline
- Add timestamps to console output
- Adding timestamps to a pipeline
- Use secret text(s) or files(s)
- Using credentials in a pipeline
- Other build environment options
- Delete workspace before build starts
- Build
- Post-Build Actions
- Post-build actions in a pipeline
- General
- Types of Projects
- Freestyle Projects
- The Maven Project Type
- The Pipeline Project Type
- The External Job Project Type
- The Multiconfiguration Project Type
- Multiconfiguration example
- Pipeline compatibility
- Ivy Projects
- Folders
- Creating a folder
- Creating items in a folder
- Moving existing items into a folder
- Managing permissions for folders
- Multibranch Pipeline Projects
- Configuration
- Branch indexing
- Individual job output and configuration
- Incorporating new branches
- GitHub Organization Projects
- Creating a GitHub Organization project
- Webhooks
- Bitbucket Team/Project Projects
- Summary
- Common Project Options
- 9. The Blue Ocean Interface
- Part 1: Managing Existing Pipelines
- The Dashboard
- The Project-Specific Page
- Simple pipeline Activity view
- Simple pipeline Branches and Pull Requests views
- Multibranch Pipeline Activity view
- Multibranch Pipeline Branches view
- Multibranch Pipeline Pull Requests view
- The Run Page
- The status banner
- Pipeline
- Step logs
- Changes
- Tests
- Artifacts
- Part 2: Working with the Blue Ocean Editor
- Creating a New Pipeline Without an Existing Jenkinsfile
- Working in the Editor
- Specifying global parts of the pipeline
- Adding a new stage
- Adding a step to a stage
- Saving and committing pipeline changes
- Editing an Existing Pipeline
- Importing and Editing Existing Pipelines
- Simple debugging and editing of an existing pipeline
- Debugging editor issues
- Adding code not supported in the editor
- Working with Pipelines from Non-GitHub Repositories
- Summary
- Part 1: Managing Existing Pipelines
- 10. Conversions
- Common Preparation
- Logic and Accuracy
- Project Type
- Systems
- Access
- Global Configuration
- Plugins
- Shared Libraries
- Converting a Freestyle Pipeline to a Scripted Pipeline
- Source
- Compile
- Unit Tests
- Distributing content across nodes
- Cleaning out workspaces
- Integration Testing
- Migrating the Next Parts of the Pipeline
- Source code analysis
- Incorporating an artifact repository
- Setting version information with parameters
- Using containers in a pipeline
- Converting from a Jenkins Pipeline Project to a Jenkinsfile
- Approach
- Migrating parameter usage to Jenkinsfiles
- Final Steps
- Including a Jenkinsfile back into a native Jenkins project
- Approach
- Converting from a Scripted Pipeline to a Declarative Pipeline
- Sample Pipeline
- The Conversion
- Starting at the start
- Adding the libraries directive
- Stages
- Steps
- Post-build processing
- Completed Conversion
- General Guidance for Conversions
- Summary
- Common Preparation
- 11. Integration with the OS (Shells, Workspaces, Environments, and Files)
- Using Shell Steps
- The sh Step
- set Options
- Language interpreters
- Executing shell scripts from shared libraries
- The bat Step
- Executing batch scripts from shared libraries
- The powershell Step
- Executing PowerShell scripts from shared libraries
- The sh Step
- Working with Environment Variables
- The withEnv Step
- Working with Workspaces
- Creating a Custom Workspace
- Cleaning a Workspace
- File patterns to be deleted
- Using other delete programs
- Other arguments
- File and Directory Steps
- Working with Files
- Reading files
- Writing files
- Checking for file existence
- Working with Directories
- dir
- pwd
- deleteDir
- Doing More with Files and Directories
- Working with Files
- Summary
- Using Shell Steps
- 12. Integrating Analysis Tools
- SonarQube Survey
- Working with Individual Rules
- Quality Gates and Profiles
- The Scanner
- Using SonarQube with Jenkins
- Global Configuration
- Using SonarQube in a Freestyle Project
- Using SonarQube in a Pipeline Project
- Leveraging the Outcome of the SonarQube Analysis
- Setting up the SonarQube webhook
- Processing the SonarQube webhook in the Jenkins DSL
- SonarQube Integration Output with Jenkins
- Code Coverage: Integration with JaCoCo
- About JaCoCo
- Integrating JaCoCo with the Pipeline
- JaCoCo Output Integration with Jenkins
- Summary
- 13. Integrating Artifact Management
- Publishing and Retrieving Artifacts
- Setup and Global Configuration
- Using Artifactory in a Scripted Pipeline
- Performing Other Tasks
- Downloading Specific Files to Specific Locations
- Uploading Specific Files to Specific Locations
- Setting Build Retention Policies
- Build Promotion
- Integration with a Declarative Pipeline
- Artifactory Integration with Jenkins Output
- Archiving Artifacts and Fingerprinting
- Summary
- 14. Integrating Containers
- Configured as a Cloud
- Global Configuration
- Using Docker Images as Agents
- Setting up a Docker cloud templatebasic options
- Container settings
- Using Cloud Images in a Pipeline
- Troubleshooting
- Agent Created on the Fly for a Declarative Pipeline
- Docker Pipeline Global Variable
- Global Variables
- Docker Application Global Variable Methods
- withServer
- withRegistry
- withTool
- Docker Image Global Variable Methods
- The inside method
- Docker Container Global Variable Methods
- Running Docker via the Shell
- Summary
- Configured as a Cloud
- 15. Other Interfaces
- Using the Command-Line Interface
- Using the Direct SSH Interface
- Using the CLI Client
- HTTP mode
- SSH mode
- Remoting mode
- Using the Jenkins REST API
- Filtering Results
- Initiating Builds
- Obtaining crumbs
- Using the Script Console
- Summary
- Using the Command-Line Interface
- 16. Troubleshooting
- Diving into Pipeline Steps
- Dealing with Serialization Errors
- Continuous Passing Style
- Serializing Pipelines
- NotSerializableException
- Handling Nonserializable Errors
- Identifying the Line in Your Script that Caused an Error
- Handling Exceptions in a Pipeline
- Using Nondeclarative Code Within a Declarative Pipeline
- Unapproved Code (Script and Method Approval)
- Unsupported Operations
- System Logs
- Timestamps
- Pipeline Durability Settings
- Summary
- Index