Build helpers create repeatable artifact names from a project name and build number so later steps can upload the exact file.

Program

Play the script to choose the build number and see the artifact name.

build_num
artifact_version_name.sh
Replay: real traced execution (multi-file project)
#!/usr/bin/env bash

build_num=42
app="web"
artifact="$app-$build_num.tar.gz"
checksum="sha256:$build_num"
echo "$artifact $checksum"
#!/usr/bin/env bash

build_num=43
app="web"
artifact="$app-$build_num.tar.gz"
checksum="sha256:$build_num"
echo "$artifact $checksum"
  1. build_num ← 42

    3build_num=424app="web"
    values this step42build_num
  2. app ← web

    3build_num=424app="web"5artifact="$app-$build_num.tar.gz"
    values this stepwebapp
  3. artifact ← web-42.tar.gz

    4app="web"5artifact="$app-$build_num.tar.gz"6checksum="sha256:$build_num"
    values this stepweb-42.tar.gzartifactwebapp42build_num
  4. checksum ← sha256:42

    5artifact="$app-$build_num.tar.gz"6checksum="sha256:$build_num"7echo "$artifact $checksum"
    values this stepsha256:42checksum42build_num
  5. echo "$artifact $checksum"

    6checksum="sha256:$build_num"7echo "$artifact $checksum"
    outputweb-42.tar.gz sha256:42
    values this stepweb-42.tar.gzartifactsha256:42checksum
  1. build_num ← 43

    3build_num=434app="web"
    values this step43build_num
  2. app ← web

    3build_num=434app="web"5artifact="$app-$build_num.tar.gz"
    values this stepwebapp
  3. artifact ← web-43.tar.gz

    4app="web"5artifact="$app-$build_num.tar.gz"6checksum="sha256:$build_num"
    values this stepweb-43.tar.gzartifactwebapp43build_num
  4. checksum ← sha256:43

    5artifact="$app-$build_num.tar.gz"6checksum="sha256:$build_num"7echo "$artifact $checksum"
    values this stepsha256:43checksum43build_num
  5. echo "$artifact $checksum"

    6checksum="sha256:$build_num"7echo "$artifact $checksum"
    outputweb-43.tar.gz sha256:43
    values this stepweb-43.tar.gzartifactsha256:43checksum
artifact An artifact is the file produced by a build for later deployment.
version A build number gives the artifact a repeatable version identifier.
checksum A checksum string records which artifact later steps should verify.