What is the `load` step and why do shared libraries replace it?
IntermediateConceptScripted pipeline, Groovy & CPS
Answer
load 'ci/helpers.groovy' evaluates a Groovy file from the workspace and returns its object, so you can call helpers.deploy(). It requires a workspace (an agent), is not versioned independently, cannot hold classes cleanly, and every repo copies the same file. Shared libraries are versioned, loaded before the pipeline starts, support classes and resources, and are reused across repos.
More on Scripted pipeline, Groovy & CPS
What does a scripted pipeline look like and when would you still write one?IntermediateWhat is CPS and why does Jenkins transform pipeline Groovy?AdvancedWhy does `java.io.NotSerializableException` happen in pipelines?AdvancedWhat does `@NonCPS` do and what are its rules?AdvancedWhy do some Groovy closures behave unexpectedly in pipelines, for example `list.each { }` or `sort`?AdvancedWhat is the `script` block in declarative, and what are its limits?Beginner