Problem rebuilding stable canary

When rebuilding stable canary, the build crashes

/var/www/discourse/lib/plugin_guard.rb:10:in `initialize': undefined method `exists?' for File:Class (NoMethodError)

However, looking at the code this was already fixed here, and when I check out the code manually then it has the fix…?

So I am a bit lost. I am using /usr/local/bin/discourse_rebuild but where does it copy the code to /lib/plugin_guard.rb ? And where does the old code come from?

The way the plugin guard works is that it copies the plugin files into the container prior to any other code being run. This allows it to catch all plugin errors regardless of their source or load order. It uses pups templates to do this. Check out the template in the guard code

You’ll see it’s loaded in the app.yml file of the canary server

- "shared/standalone/discourse-plugin-guard/templates/plugin_guard.template.yml"

If you look at the template you’ll see it’s copying the files from a repo cloned into /shared/discourse-plugin-guard. So go to that repo on the server and do a git pull to see if it’s up to date.

2 Likes

Yes, it was out of date, thanks!

Any reason why the template is not doing the git pull itself?

1 Like

No reason I can think of. That’d be a good addition.

In general, if you can think of ways to improve this setup environment-wise, you’re probably on to something :slight_smile:

1 Like

The stable canary has been rebuilt and the dashboard is showing status for stable now.
Thank you for your help Angus.

2 Likes

Yes, it was I who fixed this on Plugin Guard:

Sorry, should have PR’d these in one go but I didn’t realise the extent of the issue on that occasion.

We already have a script to update the plugin guard as part of the build process which you can
invoke manually as a one-off after plugin-guard has received a significant fix.

That is good practice: fix plugin guard, then run the update script on both servers.

Apologies, I actually upon fixing the plugin guard, I updated it on tests-passed canary and tried to access the stable canary, failed and gave up a couple of weeks ago. I didn’t pursue it at the time as stable was behind.

The reason this has hit Stable now is I suspect the version of Ruby just switched to catch up with tests-passed.

1 Like