CI and Deployment Helpers
Artifact Version
Name a Build
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.
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"
build_num ← 42
3build_num=424app="web"values this step42build_numapp ← web
3build_num=424app="web"5artifact="$app-$build_num.tar.gz"values this stepwebappartifact ← web-42.tar.gz
4app="web"5artifact="$app-$build_num.tar.gz"6checksum="sha256:$build_num"values this stepweb-42.tar.gzartifactwebapp42build_numchecksum ← sha256:42
5artifact="$app-$build_num.tar.gz"6checksum="sha256:$build_num"7echo "$artifact $checksum"values this stepsha256:42checksum42build_numecho "$artifact $checksum"
6checksum="sha256:$build_num"7echo "$artifact $checksum"outputweb-42.tar.gz sha256:42values this stepweb-42.tar.gzartifactsha256:42checksum
build_num ← 43
3build_num=434app="web"values this step43build_numapp ← web
3build_num=434app="web"5artifact="$app-$build_num.tar.gz"values this stepwebappartifact ← web-43.tar.gz
4app="web"5artifact="$app-$build_num.tar.gz"6checksum="sha256:$build_num"values this stepweb-43.tar.gzartifactwebapp43build_numchecksum ← sha256:43
5artifact="$app-$build_num.tar.gz"6checksum="sha256:$build_num"7echo "$artifact $checksum"values this stepsha256:43checksum43build_numecho "$artifact $checksum"
6checksum="sha256:$build_num"7echo "$artifact $checksum"outputweb-43.tar.gz sha256:43values 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.