I want to ensure that particular scripts are run as the first and last step in every job. Of course, I can define two
commands and insist that everyone include them in their jobs whenever they edit
config.yml, but at some point someone will forget to do that. Idieally, the same solution would work both for jobs than run on CircleCI infrastructure and for jobs that run on Runners. Any ideas of how to do this automatically?
For example, if I have the following configuration:
version: 2.1 jobs: oncci: machine: image: ubuntu-2004:202107-02 steps: - run: prepare.sh # User remembered to put this - checkout - run: foo - run: bar -run: cleanup.sh onrunner: machine: true resource_class: example-com/class-a steps: # User forgot to invoke prepare/cleanup - checkout - run: toto - run: tata workflows: testoncci: jobs: - oncircleci: testonrunner: jobs: - onrunner
What magic would cause the
cleanup.sh programs to run in the case where they were omitted?