Moving Data between Agents
Scenario: A test stage on a second node expects the build workspace from the first node to exist.
Pipeline example
stage('Build') { steps { sh './package.sh'; stash name: 'pkg', includes: 'dist/**' } }
stage('Test') { steps { unstash 'pkg'; sh './verify.sh' } }
Workspaces are local scratch space
Different agent allocations have different filesystems, even when labels match. A later stage may run on a newly provisioned machine. Stash packages selected workspace files for this build and unstash restores them elsewhere. Use narrow include patterns and purpose-specific names; do not transfer an entire checkout or dependency cache merely because it is convenient.
Stash suits modest intra-run data, not long-term release storage. Large stashes consume controller or artifact-manager resources and expire with build retention. PreserveStashes supports restart-from-stage for a bounded number of builds but does not make a package durable. Release outputs belong in an artifact repository under immutable coordinates.
Verify bytes after every handoff
Build once, create a manifest with source revision and tool versions, calculate a digest, and move those same bytes through tests and promotion. Verify checksum after unstash and after repository download. Exclude credentials, Git metadata, uncontrolled links, and temporary files.
When data is absent, check whether the producer ran, the include glob matched, retention removed state, or the consumer requested another name. Rebuilding on the destination node may turn green while destroying proof that test and release examined the same artifact.
Goal: Practice the concrete behavior in jenkins-artifact-promotion. Learn sections have no Jenkins terminal; the Jenkins lab opens the real shared service in a new full-screen tab inside your private folder.