Add re-import commands for local Drupal changes#52
Conversation
Added commands to re-import local Drupal changes after clearing the database.
kurowski
left a comment
There was a problem hiding this comment.
Can we add a command line option to let a user skip this? I intentionally left these out because I often find myself running DRUSH_TASK=cr db-rebuild.sh in order to avoid updb/cim, for example when I'm verifying that changes will deploy correctly to pre-existing environments.
Co-authored-by: Brandt Kurowski <bkurowski@uceap.universityofcalifornia.edu>
Added option to skip deployment during database reset.
option added in latest commit uceap devcontainer-reset-db --skip-deployor uceap devcontainer-reset-db -sd |
kurowski
left a comment
There was a problem hiding this comment.
I tried testing this in myeap2:
myeap2 on qa [!⇣] via 🐘 on ☁️ (us-west-2)
❯ git diff
diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml
index 240834190..dd4225762 100644
--- a/.devcontainer/docker-compose.yml
+++ b/.devcontainer/docker-compose.yml
@@ -1,6 +1,6 @@
services:
drupal:
- image: "ghcr.io/uceap/devcontainer-drupal:main"
+ image: "ghcr.io/uceap/devcontainer-drupal:pr-52"
volumes:
- ../..:/workspaces:cached
mariadb:
but couldn't rebuild my devcontainer due to a syntax error:
[2026-06-30T12:52:51.928Z] Start: Run in container: /bin/sh -c uceap devcontainer-on-create
[2026-06-30T12:52:52.000Z] /usr/local/bin/../etc/uceap.d/devcontainer_reset_db.sh: line 18: syntax error near unexpected token `newline'
[2026-06-30T12:52:52.004Z] Stop (76 ms): Run in container: /bin/sh -c uceap devcontainer-on-create
[2026-06-30T12:52:52.004Z] onCreateCommand from devcontainer.json failed with exit code 2. Skipping any further user-provided commands.
[2026-06-30T12:52:52.007Z] Error: Command failed: /bin/sh -c uceap devcontainer-on-create
You can test locally to avoid the round-trip through GitHub's pipeline (first build will take 5 minutes, future ones less than one second):
docker build -t local/devcontainer-drupal:pr-52 .Then update your docker-compose.yml to use your local tag instead of ghcr.io. Or skip the myeap2 container build if you just wanna see the error inside the image:
docker run --rm local/devcontainer-drupal:pr-52 bash -n
/usr/local/etc/uceap.d/devcontainer_reset_db.sh/usr/local/etc/uceap.d/devcontainer_reset_db.sh: line 18: syntax error near unexpected token `newline'
/usr/local/etc/uceap.d/devcontainer_reset_db.sh: line 18: ` case_end'
You can fix the error then rebuild:
sed -i '/case_end/d' local/etc/uceap.d/devcontainer_reset_db.sh
docker build -t local/devcontainer-drupal:pr-52 .
docker run --rm local/devcontainer-drupal:pr-52 bash -n /usr/local/etc/uceap.d/devcontainer_reset_db.shSyntax error is gone, but now when you rebuild myeap2 devcontainer with this change you'll see that --skip-deploy actually skips everything (i.e. skips the db reset).
…nd used by the Refresh data task I updated the uceap devcontainer-reset-db command, but the actual refresh data task in vs code uses the /usr/bin/db-rebuild.sh script. This script was failing to find the correct web root(pointing to our very old LANDO_WEBROOT) and wasn't finding the drush command once in the web root. This updates that script to work with the container and as such fix the config import after running the vs code task.
Another change was required once I started testing the container locally. I couldn't get the docker image to build in a remote Codespaces so had to drop down to local. The vs code task doesn't use the |
Added commands to re-import local Drupal changes after clearing the database.