Integrate SDF into more complex workflows with pre and post hooks
scripts
which can be executed via the sdf exec
command. In this way, you may string multiple commmands together, sequentially.
scripts
is a reserved name keyword in the config
yml block. Each property in scripts will be an independently executable command.
To execute any script run: sdf exec [SCRIPT_NAME]
Keep in mind:
stdout
and stderr
from subcommandssh
shell. Color coding will not be preserved.scripts
element to the config
block. Each element in the properties
array will become a separately executable command.
sdf exec my_script
sdf exec other_script
sdf exec macro_script
sdf compile
and sdf run
commands.
pre-compile
-> When executing sdf compile
or sdf check
or sdf report
, the script in pre-compile is executed firstpost-compile
-> When executing sdf compile
or sdf check
or sdf report
, the script in post-compile is executed after compile has successfully finishedpre-run
-> When executing sdf run
or sdf test
or sdf stats
, the script in pre-run is executed firstpost-run
-> When executing sdf run
or sdf test
or sdf stats
, the script in post-run is executed after run has successfully finishedsdf new
sdf compile
, we now run the pre-compile script first, and then post-compile resulting in the below output.
sudo sdf exec ...
will run subcommands as sudo as well.
See the below script to validate whether an SDF script is root.