Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Site image fails to be rebuilt, causing plugin install to eventually fail when Gutenberg requires newer WP. #18

Open
iandunn opened this issue Mar 10, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@iandunn
Copy link
Member

iandunn commented Mar 10, 2022

This seems to be happening on every build (not just new/expired ones)

Command failed with exit code 1: docker exec [hash] /bin/sh -c curl https://gutenberg-artifact.aduth.workers.dev/39342 -o artifact.zip; unzip artifact.zip || exit 48; wp plugin install gutenbe...

await execa( 'docker', [
'exec',
containerId,
'/bin/sh',
'-c',
`curl ${ new URL( pr, ARTIFACT_DOWNLOAD_URL ) } -o artifact.zip; unzip artifact.zip || exit 48; wp plugin install gutenberg.zip --activate`,
] );

Sentry says it started on February 2nd.

cc @tellthemachines

@iandunn iandunn added the bug Something isn't working label Mar 10, 2022
@dd32
Copy link
Member

dd32 commented Mar 14, 2022

# docker exec -ti 12c7f7aa1fd8 sh
$ wp plugin install gutenberg.zip --activate
Unpacking the package...
Installing the plugin...
Warning: The package could not be installed. "Your WordPress version is 5.7, however the uploaded plugin requires 5.8."
Plugin installation failed.
Warning: The 'gutenberg.zip' plugin could not be found.
Error: No plugins installed.

So the underlying issue is that containers are being created with WordPress 5.7 as the base (Which I've also confirmed).

The gutenberg.run handler seems to build the image once at startup, and never again.

I've re-created the image:

~/gutenberg.run/images/gutenbergrun-site# docker build -t gutenbergrun-site .

All steps ran from cache, including the wp core download step.

We should cause that step to be always run, through something like https://stackoverflow.com/questions/35134713/disable-cache-for-specific-run-commands but we can probably just download https://api.wordpress.org/core/stable-check/1.0/ into a file to cause the image to only need rebuilding when a new WordPress release happens.

That would then allow for the image rebuilding to be run on a cron task, or as part of the gutenberg.run JS.

I've rebuilt the image without using the cache;

~/gutenberg.run/images/gutenbergrun-site# docker build --no-cache -t gutenbergrun-site .
[...snip....]
---> Running in c3d10a7d5ebd
Downloading WordPress 5.9.2 (en_US)...
md5 hash verified: b5e9c3b8dfd767d55c3797c2eae0f57d
Success: WordPress downloaded.
Removing intermediate container c3d10a7d5ebd
 ---> 007b4a627f63
Step 20/20 : ENTRYPOINT [ "php", "-S", "0.0.0.0:9000" ]
 ---> Running in 0b66edb37900
Removing intermediate container 0b66edb37900
 ---> aad7c9099a95
Successfully built aad7c9099a95
Successfully tagged gutenbergrun-site:latest

Rebuilt successful, installed latest WordPress version, fired up another PR.. node still used the old tagged image - Gutenberg.run doesn't use the dynamic latest tag, instead it uses a tag specific to it, right now, that's gutenbergrun-site:1e9211fc209ed76d81f80904c2e22b1abf70b3ed.

Re-ran the build step, this time overwriting that image tag rather than latest.

Gutenberg.run is now operational again.

@dd32
Copy link
Member

dd32 commented Mar 14, 2022

right now, that's gutenbergrun-site:1e9211fc209ed76d81f80904c2e22b1abf70b3ed.

Turns out, that's the HEAD of the Git repo.

To refresh the cached site image, this can be used:

# cd ~/gutenberg.run/images/gutenbergrun-site; docker build -t gutenbergrun-site:`git rev-parse HEAD` .

This shouldn't be a crontab, but rather as an async task in the JS to rebuild the image when required. Can probably just be an hourly task to check the latest WP version matches the built image?

@dd32 dd32 changed the title Artifact fails to download (even on recent PRs) Site image fails to be rebuilt, causing plugin install to eventually fail when Gutenberg requires newer WP. Mar 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants