
Jenkins 2: Up and Running
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
More details
Other editions
Additional editions

Person
Brent Laster is a global trainer, author and speaker on open-source technologies as well as a senior R&D manager at a top technology company. He has been involved in the software industry for over 25 years, holding various technical and management positions. Brent has always tried to make time to learn and develop both technical and leadership skills and share them with others and believes that regardless of the topic or technology, there's no substitute for the excitement and sense of potential that come from providing others with the knowledge they need to help them accomplish their goals.
Content
- Intro
- Foreword
- Preface
- How to Use This Book
- Conventions Used in This Book
- Using Code Examples
- O'Reilly 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
- 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
- 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
- Summary
- 4. Notifications and Reports
- Notifications
- 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
- Reports
- Publishing HTML Reports
- Summary
- 5. Access and Security
- Securing Jenkins
- Enabling Security
- Access Control-Security Realm
- Delegate to servlet container
- Jenkins' own user database
- LDAP
- Unix user/group database
- Access Control-Authorization
- Anyone can do anything
- Legacy mode
- Logged-in users can do anything
- Matrix-based security
- Project-based matrix authorization strategy
- Other Global Security Settings
- Markup formatter
- Agents
- Prevent Cross-Site Request Forgery exploits
- CLI
- Plugin manager
- Hidden security warnings
- SSH server
- 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
- 6. Extending Your Pipeline
- Trusted Versus Untrusted Libraries
- Internal Versus External Libraries
- Internal Libraries
- SSH access
- HTTP access
- External 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
- 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
- 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
- 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
- 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 it's 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
- Build
- Post-Build Actions
- Post-build actions in a pipeline
- 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
- 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
- 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
- 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
- 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
- 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
- Summary
- 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 template-basic 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
- 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
- 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
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.