Include upgrade status job for all contrib
Problem/Motivation
Upgrade status has now support for GitLab CI reporting (#3227079: Support generating Code Quality JSON reports (for GitLab CI integration)). It is self-contained and it's just a snippet that can be copy/pasted into any GitLab CI integration.
The initial thoughts were to have the UpdateBot place that snippet in all the MRs, but maybe, since this is a task done in all contrib modules, we can integrate it from GitLab CI.
Proposed resolution
We could have the new job and add a new RUN_UPGRADE_STATUS variable (turned off by default). This way, the UpdateBot would just need to set that variable to 1 and also any maintainer that wants to do this check can just enable it.
The reusable snippet is:
upgrade-status-analysis:
extends: .testing-job-base
needs:
- composer
script:
- !reference [ .show-environment-variables ]
- !reference [ .setup-webserver ]
- !reference [ .simpletest-db ]
- !reference [ .show-context ]
- composer require drush/drush drupal/upgrade_status
- php $_WEB_ROOT/core/scripts/drupal install standard
- vendor/bin/drush --root=$_WEB_ROOT st
- vendor/bin/drush --root=$_WEB_ROOT -y en upgrade_status
# Output results via terminal and then generate the report.
- vendor/bin/drush --root=$_WEB_ROOT upgrade_status:analyze $MODULE_NAME || EXIT_CODE=$?
- vendor/bin/drush --root=$_WEB_ROOT upgrade_status:analyze $MODULE_NAME --format=codeclimate > upgrade-status-analysis.json || true
# Ensure paths in artifacts are git-relative.
- sed -i "s#modules\\\/custom\\\/$CI_PROJECT_NAME\\\/##" upgrade-status-analysis.json || true
- exit $EXIT_CODE
artifacts:
when: always
expose_as: "upgrade-status-analysis"
reports:
codequality: upgrade-status-analysis.json
paths:
- upgrade-status-analysis.json
Edited by drupalbot