Introduction
When running a Jenkins pipeline, you often want to know details about the current build like its status or number. currentBuild variables give you easy access to this information inside your pipeline scripts.
When you want to check if the current build succeeded or failed to decide next steps.
When you need to get the build number to tag artifacts or logs.
When you want to print the build URL for notifications or reports.
When you want to mark the build as unstable or aborted based on conditions.
When you want to access the current build's duration or result for analytics.