gerrit: enable plugin reload in dev mode

With a pure javascript plugin, dropping a new file in the plugins/
directory and reloading the page is sufficient to see changes.
However, with .jar plugins (as zuul-summary-plugin now is) you need to
actually issue a reload, which requires the included permissions.

Enable it dev mode, which is where you'll very likely be trying to
iterate development with a change to a plugin.  I don't think it's
really that dangerous for production, but traditionally it's been off
there so let's leave it like that.

While we're here, write out a little script to help you quickly deploy
a new .jar of the plugin when we're testing.

Change-Id: I57fa18755f8a8168da12c48f1f38d272da1c6599
This commit is contained in:
Ian Wienand 2021-05-03 15:19:49 +10:00
parent 8346b9ac6f
commit 58ba847c07
2 changed files with 25 additions and 0 deletions

View File

@ -19,6 +19,9 @@
{% else %}
[auth]
type = DEVELOPMENT_BECOME_ANY_ACCOUNT
# In dev mode it's very useful to be able to reload plugins
[plugins]
allowRemoteAdmin = true
{% endif %}
[sendemail]
smtpServer = localhost

View File

@ -105,6 +105,28 @@
popd
# This is helpful on a held node when you're trying to fix/enhance
# the Zuul summary plugin. You can build it locally, scp the new
# .jar to /tmp and run this to deploy your changes.
- name: Create summary plugin helper script
shell:
executable: /bin/bash
cmd: |
set -xe
cat > /root/deploy-zuul-results-summary.sh << EOF
#!/bin/bash
echo "Copying plugin"
docker cp /tmp/zuul-results-summary.jar \
gerrit-compose_gerrit_1:/var/gerrit/plugins/
echo "Reloading"
ssh -i /root/.ssh/id_25519 -p 29418 admin@localhost \
gerrit plugin reload zuul-results-summary
echo "Done"
EOF
chmod a+x /root/deploy-zuul-results-summary.sh
- name: Create temp dir for project creation
shell: mktemp -d
register: project_tmp