Skip to content

Add re-import commands for local Drupal changes#52

Merged
shaundrong merged 5 commits into
mainfrom
shaundrong-cim-updb-after-devcontainer-reset
Jul 1, 2026
Merged

Add re-import commands for local Drupal changes#52
shaundrong merged 5 commits into
mainfrom
shaundrong-cim-updb-after-devcontainer-reset

Conversation

@shaundrong

Copy link
Copy Markdown
Contributor

Added commands to re-import local Drupal changes after clearing the database.

Added commands to re-import local Drupal changes after clearing the database.

@kurowski kurowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread local/etc/uceap.d/devcontainer_reset_db.sh Outdated
shaundrong and others added 2 commits June 24, 2026 19:38
Co-authored-by: Brandt Kurowski <bkurowski@uceap.universityofcalifornia.edu>
Added option to skip deployment during database reset.

@kurowski kurowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx!

@shaundrong

Copy link
Copy Markdown
Contributor Author

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.

option added in latest commit

uceap devcontainer-reset-db --skip-deploy

or

uceap devcontainer-reset-db -sd

@kurowski kurowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh

Syntax 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).

@kurowski kurowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…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.
@shaundrong

shaundrong commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

LGTM

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 uceap devcontainer-reset-db command but instead uses uceap refresh-content which calls our old lando script (/usr/local/bin/db-rebuild.sh). So I Update the script to work within the container vs our old lando setup.

@shaundrong shaundrong requested a review from kurowski July 1, 2026 18:39

@kurowski kurowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@shaundrong shaundrong merged commit 6a3a9c1 into main Jul 1, 2026
1 check passed
@shaundrong shaundrong deleted the shaundrong-cim-updb-after-devcontainer-reset branch July 1, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants