Disallow `before_script` and `after_script` when `run` is used
The plan for CI Steps is to replace before_script and after_script with setup and teardown respectively. To that end, when run is specified the rails backend currently omits before_script and after_script from the JobRequest. That's OK. However, it is currently possible to create a valid CI job configuration WITH before_script and after_script sections. For example, this CI job is valid and runs:
variables:
FF_USE_NATIVE_STEPS: true
STEP_RUNNER_IMAGE: ""registry.gitlab.com/gitlab-org/step-runner/pipelines"
STEP_RUNNER_VERSION: "982"
stage: test
image:
name: alpine:latest
before_script: apk add bash <-- never makes it to the runner
after_script: echo "we are done here" <-- never makes it to the runner
run:
- name: the_step
script: echo "doin' some work..."
The job fails however because the script step requires bash, but it is not installed by default in a vanilla alpine image, and the before_script was (obviously) not run.
This is confusing. This job should produce a syntax error clearly stating that before_script and after_script are not allowed when run is used.