Archiving Build Artifacts

archiveArtifacts copies files from the workspace to the controller, where they stay with the build (and go when buildDiscarder deletes it). BookNest's image lives in the registry, so the Push stage archives a pointer to it: the digest the registry assigned, written by docker image inspect:

Recording the pushed digest as an artifact (excerpt)Groovy
        sh 'docker image inspect -f "{{index .RepoDigests 0}}" "$IMAGE:$TAG" > image.txt'
        archiveArtifacts artifacts: 'image.txt', fingerprint: true
Downloading build 4's artifactShell
curl -s -u "admin:$JENKINS_TOKEN" http://localhost:32080/job/booknest/job/main/4/artifact/image.txt
Output
localhost:32550/booknest-api@sha256:b3f2ffe2dd3f5bfebbdf393244be25d4f0b64e2c33003edf01e33901780
  a6a8f

fingerprint: true records the file's MD5 checksum, linking any later job that uses the same file back to this build. Archive small things such as reports and digests; large binaries belong in a registry, because every archived megabyte grows JENKINS_HOME and its backups (Backing Up JENKINS_HOME).