
Explore Jenkins pipeline syntax with an interactive spreadsheet that navigates decorative syntax (pipeline) and scripted syntax (node). Prepare for a hello world pipeline in the next lesson.
Create a hello world pipeline script in Jenkins with agents and stages. Define a steps section and an echo step to print hello world, and view the console output.
Explore how the script step extends declarative Jenkins pipelines using Groovy to perform complex flows, including if-else logic, sleep, and echo printing.
Apply retry and timeout steps in Jenkins pipelines using the Workflow Basic Steps plugin, including nested configurations with sleep and error steps.
Explore the tool section in Jenkins pipelines, configuring preinstalled tools via global tools configuration in managed Jenkins, then run a pipeline shell step to display Maven version and Maven home.
Explore the timeout option in the pipeline options directive to delay before steps and demonstrate how a one-second timeout with a two-second sleep times out the stage.
Learn to timestamp console output by applying timestamp options at the stage and pipeline levels, showing timestamps for build and for every echo line.
Use a timestamp block inside the stage's steps as an alternative to placing timestamps in the options, since pipeline or options level timestamps trigger syntax errors.
Explore the environment directive at pipeline and stage levels, access environment variables and credentials by ID, and observe stage precedence and credential masking in scripts.
Demonstrate how the building tag condition limits stage execution to tagged commits, and how tag patterns in a Jenkins multi-branch pipeline enable selective builds from GitHub tags such as 1.0.
Explore how the changelog condition gates a pipeline stage by requiring commit messages to match a regular expression in a multi-branch Jenkins pipeline.
Explore the post section in Jenkins pipelines, with post condition blocks like success, failure, always, and cleanup, applicable at pipeline and stage levels, using the script block and currentBuild.
Explore the disable concurrent builds option in the options directive to prevent concurrent access to shared resources, demonstrated by one job waiting for another to finish.
Learn how the checkout to subdirectory option in Jenkins directs code to a subfolder in the workspace, shown with a GitHub repository containing a Jenkins file and a text file.
Explore how the new container per stage option lets each pipeline stage run a fresh container with distinct container ids during build and deploy, using a pipeline-level image.
Explore how the upstream trigger in Jenkins activates the current job when upstream jobs finish with specified status, such as unstable or failure, and how status changes affect downstream builds.
Demonstrate the arcs parameter to pass docker run arguments and set an environment variable with -e in a Jenkins job, then echo and verify the some env value in build.
Utilize the label parameter to run a Jenkins pipeline stage on a specific node, demonstrated by executing a Maven image on slave one and printing Maven version.
Explore how the reused node parameter directs container execution across agents and stages, with true or false settings showing build on slave two and deploy on slave one.
Master the Docker file parameter of agent to run a container for a Jenkins pipeline stage, including workspace polling and building from Ubuntu latest with a GitHub Docker file.
Shows how to use the Dockerfile dir option to locate a Dockerfile in a subdirectory, build Ubuntu latest image, check out from GitHub, run the container, and print OS details.
Explore how to use additional build args in a Dockerfile within a Jenkins pipeline, tag the image, checkout from a GitHub repo, and print operating system details.
Explore using static methods in shared libraries for Jenkins pipelines. Learn to import static methods and call them directly or dynamically via a qualified name with the validator utils example.
Learn how closures enable custom steps in Groovy Jenkins pipelines by building an execute in script step that runs a closure block and prints environment variables via a shared library.
Import third party java libraries from Maven Central into a pipeline script using grape's ad grab annotation to load the Apache Commons StringUtils, then uppercase text in Groovy.
Learn to load non groovy resources from a Jenkins shared library by storing a json file in the resources directory, importing the library with ad library syntax, and echoing it.
Import the shared library, call the custom step with a string parameter to select and run the corresponding pipeline script (build, deploy, or do nothing) in Jenkins.
Explore scripted pipeline syntax using Groovy, including node blocks and stages, with examples showing execution on the master and slave nodes and the differences from declarative pipelines.
Discover how to locate a Dockerfile in a subdirectory within scripted pipelines, build an image from the Ubuntu latest base, and print OS details in a Jenkins job.
Learn to implement building tag and tag conditions of the when directive. See how tag name environment variable selects tag builds versus branch builds for release 1.0 and 2.0.
Learn to implement the change set condition of the when directive in scripted pipelines using groovy, a GitHub repo, and js file changes to trigger build stages.
Implement input in scripted pipeline code by declaring a user input variable, echoing the selection, and using a timeout block to avoid a stalled build when no input is provided.
Demonstrate implementing the build discarded option in scripted pipeline code by creating a Jenkins job. Observe how the property keeps only one build log for demonstration.
Demonstrates implementing disable concurrent builds in a Jenkins scripted pipeline, configuring properties, and observing builds queue and wait for prior runs versus allowing concurrent executions.
Set up a Jenkins pipeline with two stages that create a new container per stage using the options directive, printing the Maven version in each stage.
Learn to use upstream option in triggers directive of scripted pipeline code to auto-build a Jenkins job when upstream jobs succeed, with unstable, failure, not built, and aborted statuses.
Learn to trigger downstream jobs from a parent in Jenkins pipelines and pass data via deploy env parameter. Use build step and pipeline syntax to generate scripts.
Explore the lockable resources plugin to enable resource locking among competing builds, using logical resources, labels, and reserved by text in Jenkins.
More lectures on their way!
*** Please note that this is NOT a how to set up Jenkins course. This is a course for people who ALREADY knows what jenkins pipelines are used for, want to use it and want to get up to speed with the syntax or learn more about it quickly.***
*** Get latest course updates in the readme when you search for user pipelineascodecourse in github ***
Are you looking to use Jenkins pipeline as code FAST?
"With Pipelines, organisations can define their delivery pipeline through a DSL (Pipeline-as-code). Pipelines, thus, can be versioned, checked into source and easily shared within an organisation. "
"The Pipeline DSL helps you capture complex process requirements through code - thus you can try-catch on deployment failures, loop through deployments, run tests in parallel. It brings the power of a programming language (groovy) to do so. At the same time, the DSL is simple enough to capture simple cases easily without having to touch groovy code. You can capture common patterns in functions and keep them in a global library so that new applications can build on these functions rather than re-invent. "
Source: Cloudbees - Jenkins Pipeline - Software Delivery Made Easy
Jenkins Pipeline as Code allows you to define and automate pipelined job processes with code. Code that can be stored and versioned in a repository which allows you to track changes over time and used by jenkins to run build jobs. If you are already using Jenkins, you should have already heard of pipeline as code but if you have not, this course will help you learn what it is, and also help you to get started quickly with it to make your life as a devops practitioner much easier. This course will help you understand and use both declarative and scripted pipeline scripts and how to use shared libraries for common code across build jobs with realtime demonstrations of the pipeline scripts.