Deploying Gerrit involves a few manual steps https://wikitech.wikimedia.org/wiki/Gerrit/Upgrade#Deploying
They should be automatized and it seems like scap checks can fulfill that role.
I have finished the scap setup for Gerrit on the devtools WMCS project (T317404). The instances are:
| Role | Instance FQDN |
|---|---|
| Deployment | deploy-1004.devtools.eqiad1.wikimedia.cloud |
| Gerrit | gerrit-prod-1001.devtools.eqiad1.wikimedia.cloud |
Fixes:
- we should disable/enable Puppet which requires a sudo rule
- Gerrit is deployed using the gerrit2 service user, the deployment should probably be done with a new user which could receive additional sudo privileges
- changes to gerrit.config by Puppet should result in an error and prompt a rollback
- the plugin should be extracted after the fetch phase under $SCAP_REV_PATH. Gerrit config points to /var/lib/gerrit2/review_site which is the $SCAP_FINAL_PATH dir.
- promote should restart the service
- figure out a check which once the service has started verifies the list of plugins and potentially their versions
Will probably need something similar to what has been done for Phabricator in https://gerrit.wikimedia.org/r/c/operations/puppet/+/370622 and currently in Puppet at:
modules/phabricator/files/phab_deploy_config_deploy.sh
modules/phabricator/files/phab_deploy_finalize.sh
modules/phabricator/files/phab_deploy_promote.sh
modules/phabricator/files/phab_deploy_rollback.sh
modules/phabricator/templates/script-vars.erb
The scripts have sudo rules:
'ALL=(root) NOPASSWD: /usr/local/sbin/phab_deploy_config_deploy', 'ALL=(root) NOPASSWD: /usr/local/sbin/phab_deploy_promote', 'ALL=(root) NOPASSWD: /usr/local/sbin/phab_deploy_rollback', 'ALL=(root) NOPASSWD: /usr/local/sbin/phab_deploy_finalize',
The user being phab-deploy.