From e7aee13ee82fe50e9b021b095f79e8d71ef10085 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 19 May 2026 14:17:28 +0900 Subject: [PATCH] Apply ORA_TZFILE workaround to devcontainer #292 added the ORA-01805 workaround to the remaining `gvenzl/oracle-free` CI workflows. The same root cause -- the server image shipping a newer timezone-data version than the "latest" Instant Client embeds -- affects the dev container, which combines `gvenzl/oracle-free:latest` (Oracle service) with the Instant Client installed via the app `Dockerfile` and talks to it through ruby-oci8. Mirror the workflow step in `postCreateCommand.sh` immediately after `ci/setup_accounts.sh`: locate the running Oracle container, copy its `timezlrg_*.dat` onto the Instant Client's `oracore/zoneinfo`, and persist `ORA_TZFILE` via `/etc/profile.d/ora_tzfile.sh` so every login shell (and the rspec runs they launch) sees the override. The Docker CLI and the host docker socket needed to drive `docker exec` / `docker cp` are provided by the standard `ghcr.io/devcontainers/features/docker-outside-of-docker` feature, added alongside the existing Ruby feature in `devcontainer.json`. The lookup is dynamic, so a future gvenzl image bump continues to work without further edits. Co-Authored-By: Claude Opus 4.7 (1M context) --- .devcontainer/devcontainer.json | 3 ++- .devcontainer/postCreateCommand.sh | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b845dee..1bf4290 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,8 @@ "features": { "ghcr.io/rails/devcontainer/features/ruby:2": { "version": "4.0.3" - } + }, + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} }, "customizations": { "vscode": { diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index 22c8c4b..039f2c5 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -22,4 +22,21 @@ fi ci/setup_accounts.sh +# Force client TZ data to match server (ORA_TZFILE workaround). +# Mirrors the CI workaround added in rsim/ruby-plsql#292: gvenzl/oracle-free +# ships a newer timezone-data version than the "latest" Instant Client embeds, +# so ruby-oci8 raises ORA-01805 for DATE/TIMESTAMP fetches unless the client +# uses the server's timezlrg_*.dat. The Docker CLI and socket are provided by +# the docker-outside-of-docker devcontainer feature. +ORACLE_CONTAINER=$(docker ps --filter "ancestor=gvenzl/oracle-free" -q) +SRC=$(docker exec "$ORACLE_CONTAINER" bash -c 'ls $ORACLE_HOME/oracore/zoneinfo/timezlrg_*.dat 2>/dev/null | head -1') +echo "Server TZ file: $SRC" +DST_DIR="$ORACLE_HOME/oracore/zoneinfo" +sudo mkdir -p "$DST_DIR" +docker cp "$ORACLE_CONTAINER":"$SRC" /tmp/_server_tzfile.dat +sudo mv /tmp/_server_tzfile.dat "$DST_DIR/$(basename "$SRC")" +ls -l "$DST_DIR" +echo "export ORA_TZFILE=$DST_DIR/$(basename "$SRC")" | sudo tee /etc/profile.d/ora_tzfile.sh > /dev/null +sudo chmod +x /etc/profile.d/ora_tzfile.sh + echo "Dev container setup complete. You are ready to start developing ruby-plsql!"