AutoDevOps is broken for projects that configured license scanning job

Summary

The change introduced by Remove License Scanning from AutoDevOps (!129139 - merged) broke AutoDevOps configurations that had overridden the license_scanning job, such as this one:

license_scanning:
  rules:
    - if: "$LICENSE_MANAGEMENT_DISABLED"
      when: never
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $GITLAB_FEATURES =~ /\\blicense_scanning\\b/
    - if: "$CI_COMMIT_BRANCH && $GITLAB_FEATURES =~ /\\blicense_scanning\\b/"

Before the removal of the Jobs/License-Scanning.gitlab-ci.yml template by Remove License Scanning from AutoDevOps (!129139 - merged), the above license_scanning job would override the existing defined job, however, after the Jobs/License-Scanning.gitlab-ci.yml template was removed, any custom license_scanning override jobs became standalone jobs, and as such required a script keyword which results in the following invalid yaml failure:

Steps to reproduce

  1. Create new project on a self-managed GitLab instance running release 16.3.

  2. Add a .gitlab-ci.yml file that includes the Auto-DevOps.gitlab-ci.yml template as well as overrides the license_scanning job:

    include:
      - template: Auto-DevOps.gitlab-ci.yml
    
    license_scanning:
      variables:
        SOME_VAR: "some value"
  3. Notice that the pipeline shows the error message jobs license scanning config should implement a script: or a trigger: keyword:

What is the current bug behavior?

Pipeline refuses to run becasue of a yaml invalid error

What is the expected correct behavior?

Pipeline should run and license_scanning job should fail

Workaround

Remove any custom license_scanning jobs, for example this MR: Remove deprecated license scanning job (gitlab-org/gitlab-services/version.gitlab.com!34 - merged).

Possible fixes

Re-add Jobs/License-Scanning.gitlab-ci.yml template to Auto-DevOps.gitlab-ci.yml template.

This has been fixed in %16.4 with Fix AutoDevOps for projects that configured lic... (!129658 - merged), however, we need to create a patch release for %16.3 with this fix.

/cc @gonzoyumo @brytannia

Edited by Adam Cohen