In addition to the composition point consider also
Use before_script to define an array of commands that should run before each job’s script commands, but after artifacts are restored.
from official doc