Mediawiki developers, have you ever thought, “I wish I could deploy my own code for Mediawiki”? Now you can! More deploys! More fun!
Next time you want to get some code deployed, why not try scap backport?
One Command To Deploy
scap backport is one command that will +2 your patch, deploy to mwdebug and wait for your approval, and finally sync to all servers. You only need to provide the change number or gerrit url of your change.
You can run scap backport on patches that have already merged, or re-run scap backport if you decided to cancel in the middle of a run. scap backport can also handle multiple patches at a time. After all the patches have been merged, they’ll be deployed all together. scap backport will confirm that your patches are deployable before merging, and double check no extra patches have sneaked into your deployment.
One Command To Revert
And if your code didn’t work out, don’t worry, there’s scap backport —revert, which will create a revert patch, send it to Gerrit, and run all steps of scap backport to revert your work. You’re offered the choice to give a reason for revert, which will show up in the commit message. Just be aware that you'll need to wait for tests to run and your code to merge before it gets synced, so in an emergency this might not be the best option.
Extra Information
You can also list available backports or reverts using the —list flag!
If you'd like some guidance on deploying backports, please sign up here to join us for backport training, which happens once a week on Thursday during the UTC late backport window!
Scap Backport In Action
Compare to Manual Steps
For comparison, the previous way to backport would require the user to enter the following commands on the deployment host:
cd /srv/mediawiki-staging/php-<version> git status git fetch git log -p HEAD..@{u} git rebase
Then, if there were changes to an extension: git submodule update [extensions|skins]/<name>
Then, log in to mwdebug and run scap pull
Then, back on the deployment host: scap sync-file php-<version>/<path to file> 'Backport: [[gerrit:<change no>|<subject> (<bug no>)]]' for each changed file
Example Usage
List backports
scap backport --list
Backport change(s)
scap backport 1234
scap backport https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1234
scap backport 1234 5678
Merge but do not sync
scap backport --stop-before-sync 1234
List revertable changes
scap backport --revert --list
Revert change(s)
scap backport --revert 1234
scap backport --revert 1234 5678
That's all for now, and happy backporting!
Event Timeline
🌟🌟🌟🌟🌟 | Seasoned deployer | The product does exactly what is written on the can: give it a change number and the change ends up promoted to production. I am never looking back at previous deployment methods and highly recommend. |
Yeah, this is a massive improvement in deployer quality of life. I look forward to entirely forgetting the series of commands I've been copy-and-pasting for all this time.
Agreed, this is a huge improvement over the semi-manual process we were using until now!
Outstanding! I can't wait to try this out. Hearty congratulations to all involved shipping this feature.