Capstone Automation Project
Dry Run
Choose Safe Commands
Automation should separate planning from applying changes. A dry-run branch shows the command that would run without allowing real changes.
Program
Play the script to switch between dry-run and apply mode.
dry_run_release_command.sh
#!/usr/bin/env bash
mode=
target="staging"
if [[ "$mode" == "dry-run" ]]; then
command="printf preview:$target"
effect="no-change"
else
command="deploy --target $target"
effect="changes-allowed"
fi
echo "$mode $effect $command"
#!/usr/bin/env bash
mode=
target="staging"
if [[ "$mode" == "dry-run" ]]; then
command="printf preview:$target"
effect="no-change"
else
command="deploy --target $target"
effect="changes-allowed"
fi
echo "$mode $effect $command"
dry run
A dry run reports intent without applying changes.
apply mode
Apply mode is the branch that would permit changes.
command plan
Keeping the command as data makes the selected action inspectable.