Skip to content

chore: more docker improvements#2004

Merged
sevenzing merged 9 commits intomainfrom
ll/docker-v2
Apr 29, 2026
Merged

chore: more docker improvements#2004
sevenzing merged 9 commits intomainfrom
ll/docker-v2

Conversation

@sevenzing
Copy link
Copy Markdown
Member

@sevenzing sevenzing commented Apr 28, 2026

Summary

  • Updates Docker compose stack structure by renaming postgres service config to ensdb and refining service/environment wiring across compose files.
  • Updates docker/envs/.env.docker.devnet and removes environment key from docker-composes
  • Introduces scripts/sync-docker-services-tags.mjs (AI GENERATED!!!) and updates package/workflow wiring to keep Docker service tags synchronized for release flows.

Why

Resolving comments after previous PR was merged:
#1965 (review)


Testing

  • ENSNODE_TAG=123 docker compose -f docker/docker-compose.devnet.yml config shows replaced data

Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

@sevenzing sevenzing requested a review from a team as a code owner April 28, 2026 13:24
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 28, 2026

⚠️ No Changeset found

Latest commit: 34ec5cc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Apr 29, 2026 1:43pm
ensnode.io Ready Ready Preview, Comment Apr 29, 2026 1:43pm
ensrainbow.io Ready Ready Preview, Comment Apr 29, 2026 1:43pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

📝 Walkthrough

Walkthrough

Renames the PostgreSQL service from postgres to ensdb across Docker Compose and env files, updates Docker service images to use an ENSNODE_VERSION fallback tag, adjusts devnet environment variables, renames Changesets publish scripts to colon form and adds a docker-version sync script, and updates CI workflows and orchestrator references.

Changes

Cohort / File(s) Summary
Docker Compose Service Refactoring
docker/docker-compose.yml, docker/docker-compose.devnet.yml, docker/docker-compose.orchestrator.yml, docker/services/ensdb.yml
Renames postgres service to ensdb, updates service dependencies/health checks to ensdb, renames volume postgres_dataensdb_data, and updates container/volume names.
Environment Configuration
docker/envs/.env.docker.common, docker/envs/.env.docker.devnet
Changes ENSDB_URL hostname from postgresensdb; adds devnet variables (ENSINDEXER_SCHEMA_NAME, RPC_URL_1, LABEL_SET_ID, RPC_URL_15658733).
Docker Service Image Tagging
docker/services/ensapi.yml, docker/services/ensadmin.yml, docker/services/ensindexer.yml, docker/services/ensrainbow.yml
Replaces hardcoded :latest image tags with a parameterized fallback using ${ENSNODE_VERSION:-1.10.1}; removes restart for ensrainbow in one file and adds restart: unless-stopped to others.
NPM Scripts & Release Infrastructure
package.json, scripts/sync-docker-services-tags.mjs, .github/workflows/release.yml, .github/workflows/release_snapshot.yml
Renames Changesets scripts to colon form (changeset-publish*changeset:publish*), moves OpenAPI generation into a new release:postversion hook, adds docker:version:sync script and new scripts/sync-docker-services-tags.mjs to sync Docker YAML tag fallbacks, updates workflows to call the new script names.
Integration Test Orchestration
packages/integration-test-env/src/orchestrator.ts
Updates orchestrator to bring up and wait for ensdb (not postgres) in Phase 1, adjusts container lookups, mapped ports, and related logs/messages.
Documentation & README
docker/README.md, docs/ensnode.io/src/content/docs/docs/deploying/docker.mdx
Documentation updated to reference ensdb instead of postgres, and devnet compose examples adjusted to start services aligned with the new service name.
Apps metadata
apps/ensapi/package.json
Adds version:current script to output the package version; minor punctuation formatting in generate:gqlschema script.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

Poem

🐰 I hopped through compose and env with glee,
Renamed postgres to ensdb for thee.
Tags now dance on ENSNODE_VERSION bright,
Scripts sync versions through the night—
A tiny rabbit cheers release harmony! 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'chore: more docker improvements' is vague and overly generic, using non-descriptive language that doesn't clearly convey the specific changes made in the PR. Consider a more specific title that highlights key changes, such as 'chore: rename postgres service to ensdb and sync docker tags on release' to better reflect the substantive refactoring and new automation.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description addresses all required template sections with concrete details about the changes, reasons, and testing approach, though the introduction of an AI-generated script is appropriately flagged.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ll/docker-v2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 28, 2026

Greptile Summary

This PR completes a Docker stack cleanup by renaming the postgres service to ensdb consistently across all compose files, service definitions, and tooling, and moves devnet-specific environment variables out of inline environment: blocks into .env.docker.devnet. It also introduces scripts/sync-docker-services-tags.mjs wired into the release:postversion hook to keep ${ENSNODE_VERSION:-x.y.z} fallbacks in service YAML files in sync with the published version after every changeset release, replacing the previous latest image tags.

Confidence Score: 5/5

Safe to merge — all changes are consistent renames, environment restructuring, and a well-scoped version-sync script with no logic errors.

Both previously flagged issues (stateful global regex and committed ENSNODE_TAG override) have been addressed. The rename from postgres→ensdb is applied uniformly across all 18 files. The sync script correctly uses separate non-global test and global replace patterns, validates SemVer input, and is only called after changeset version has updated package.json files. No P0 or P1 issues found.

No files require special attention.

Important Files Changed

Filename Overview
scripts/sync-docker-services-tags.mjs New script that updates ENSNODE_VERSION fallbacks in service YAML files; correctly uses separate non-global test pattern and global replace pattern, addressing the prior review concern.
package.json Renames changeset-publish scripts to changeset:publish for naming consistency, adds release:postversion hook that chains docker:version:sync and OpenAPI generation, and introduces docker:version:sync driven by ensapi's current version.
docker/docker-compose.yml Renames postgres service to ensdb, adds restart:unless-stopped to all services (consolidating what was previously only on ensrainbow), and updates depends_on references.
docker/docker-compose.devnet.yml Moves devnet-specific environment variables (RPC URLs, SCHEMA_NAME, LABEL_SET_ID) out of inline environment blocks into .env.docker.devnet; renames postgres to ensdb throughout.
docker/envs/.env.docker.devnet Receives the variables previously hardcoded in docker-compose.devnet.yml environment blocks; all values are correct for the devnet stack.
docker/envs/.env.docker.common ENSDB_URL hostname updated from postgres to ensdb to match renamed service; ENSNODE_TAG/ENSNODE_VERSION no longer pinned here, resolving the previously flagged version-mismatch concern.
docker/services/ensdb.yml Renamed from postgres.yml; service and volume identifiers updated to ensdb; image and healthcheck unchanged.
.github/workflows/release.yml Updates publish command reference from changeset-publish to changeset:publish to match renamed root-level npm script.
packages/integration-test-env/src/orchestrator.ts Renames all postgres references to ensdb in comments, variable names, and testcontainers wait/up calls to match the renamed Docker service.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[PR merged to main] --> B[changesets/action triggered]
    B --> C["pnpm changeset:version\n(version command)"]
    C --> C1[changeset version\nupdates package.json files]
    C1 --> C2["pnpm release:postversion"]
    C2 --> C3["pnpm docker:version:sync\nreads ensapi version\nvia version:current script"]
    C3 --> C4["sync-docker-services-tags.mjs\nupdates ENSNODE_VERSION:-x.y.z\nin all service YAML files"]
    C2 --> C5[pnpm generate:openapi]
    C4 --> D[changesets/action commits\nversion bump + updated service files\nto Release PR]
    D --> E{Release PR merged?}
    E -- Yes --> F["pnpm changeset:publish\n(publish command)"]
    F --> G[NPM packages published]
    F --> H[Docker images built\nand pushed to GHCR]
    H --> I["Images tagged with\nENSNODE_VERSION from\nservice file defaults"]

    style C4 fill:#d4edda,stroke:#28a745
    style D fill:#d4edda,stroke:#28a745
Loading

Reviews (6): Last reviewed commit: "fix pr comments" | Re-trigger Greptile

Comment thread docker/envs/.env.docker.common Outdated
Comment thread scripts/sync-docker-services-tags.mjs Outdated
Comment thread scripts/sync-docker-services-tags.mjs Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docker/envs/.env.docker.common`:
- Line 4: The shared env file currently hardcodes ENSNODE_TAG=1.9.0 which
overrides service fallback defaults; either remove or comment out the
ENSNODE_TAG line in docker/envs/.env.docker.common so services use their
${ENSNODE_TAG:-...} fallbacks, or update the sync script
(scripts/sync-docker-services-tags.mjs) and CI process to also update this file
on releases; pick one approach and apply it consistently so ENSNODE_TAG is no
longer silently desynced across services.

In `@docker/services/ensadmin.yml`:
- Line 4: The Docker service image fallback is pinned one version behind; update
the default tag used in the image declaration (the `${ENSNODE_TAG:-1.10.1}`
fallback) to the current repo version by replacing `1.10.1` with `1.10.2` so
that when `ENSNODE_TAG` is unset the service pulls the latest intended image;
ensure the change is applied to the `image:
ghcr.io/namehash/ensnode/ensadmin:${ENSNODE_TAG:-1.10.1}` line to become
`${ENSNODE_TAG:-1.10.2}`.

In `@scripts/sync-docker-services-tags.mjs`:
- Line 13: The semverRegex constant currently only allows either a prerelease or
build metadata but not both; update the pattern used by semverRegex (and any
duplicate occurrences around the block referenced) to accept an optional
prerelease segment followed optionally by a build metadata segment in the
correct order (core version \\.x\\.x, optional prerelease prefixed by '-', then
optional build metadata prefixed by '+'), and ensure character classes allow
dot-separated identifiers per SemVer (alphanumerics and hyphens for prerelease,
alphanumerics and hyphens for build identifiers) so strings like
"1.2.3-rc.1+build.7" match.
- Around line 36-45: The global regex `pattern` (const pattern =
/\$\{ENSNODE_TAG:-[^}]+\}/g) shares lastIndex across iterations and causes false
negatives when using pattern.test() in the loop over `serviceFiles`; fix by
removing the global flag or recreating/resetting the regex before each use
(e.g., use const pattern = /\$\{ENSNODE_TAG:-[^}]+\}/ without /g, or set
pattern.lastIndex = 0 before calling pattern.test(content)) so the check in the
loop that throws the Error when the ENSNODE_TAG default expression is missing
behaves correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6fe7ad89-c0e5-4fe4-813a-09d7535cfc7b

📥 Commits

Reviewing files that changed from the base of the PR and between 16ecad1 and 9271733.

📒 Files selected for processing (17)
  • .github/workflows/release.yml
  • .github/workflows/release_snapshot.yml
  • apps/ensapi/package.json
  • docker/README.md
  • docker/docker-compose.devnet.yml
  • docker/docker-compose.orchestrator.yml
  • docker/docker-compose.yml
  • docker/envs/.env.docker.common
  • docker/envs/.env.docker.devnet
  • docker/services/ensadmin.yml
  • docker/services/ensapi.yml
  • docker/services/ensdb.yml
  • docker/services/ensindexer.yml
  • docker/services/ensrainbow.yml
  • docs/ensnode.io/src/content/docs/docs/deploying/docker.mdx
  • package.json
  • scripts/sync-docker-services-tags.mjs

Comment thread docker/envs/.env.docker.common Outdated
Comment thread docker/services/ensadmin.yml Outdated
Comment thread scripts/sync-docker-services-tags.mjs Outdated
Comment thread scripts/sync-docker-services-tags.mjs Outdated
@sevenzing sevenzing changed the title chore: more docker improvement chore: more docker improvements Apr 28, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 28, 2026

Want your agent to iterate on Greptile's feedback? Try greploops.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docker/envs/.env.docker.devnet`:
- Line 19: Remove the extra blank line that appears immediately before the TODO
block (the `TODO` comment) so the TODO line directly follows the previous entry;
this will clear the dotenv-linter ExtraBlankLine warning by ensuring no empty
line exists between the previous env variable and the TODO comment.

In `@package.json`:
- Around line 15-19: The npm script "changeset:version" no longer runs artifact
generation/sync and can leave OpenAPI and Docker tag defaults stale; update the
"changeset:version" script so it runs the post-version steps (either by
appending "&& pnpm docker:tag:sync && pnpm generate:openapi" or by invoking the
existing "release:postversion" script) so that running pnpm changeset:version
produces atomic, up-to-date release artifacts; ensure you reference the exact
script names "changeset:version", "release:postversion", "generate:openapi", and
"docker:tag:sync" in the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4cdcae72-35f7-49ed-bf8c-c04591fc1f27

📥 Commits

Reviewing files that changed from the base of the PR and between 9271733 and e41d950.

📒 Files selected for processing (17)
  • .github/workflows/release.yml
  • .github/workflows/release_snapshot.yml
  • docker/README.md
  • docker/docker-compose.devnet.yml
  • docker/docker-compose.orchestrator.yml
  • docker/docker-compose.yml
  • docker/envs/.env.docker.common
  • docker/envs/.env.docker.devnet
  • docker/services/ensadmin.yml
  • docker/services/ensapi.yml
  • docker/services/ensdb.yml
  • docker/services/ensindexer.yml
  • docker/services/ensrainbow.yml
  • docs/ensnode.io/src/content/docs/docs/deploying/docker.mdx
  • package.json
  • packages/integration-test-env/src/orchestrator.ts
  • scripts/sync-docker-services-tags.mjs

Comment thread docker/envs/.env.docker.devnet Outdated
Comment thread package.json Outdated
Comment thread docker/docker-compose.devnet.yml
Comment thread scripts/sync-docker-services-tags.mjs Outdated
Comment thread scripts/sync-docker-services-tags.mjs Outdated
Comment thread .github/workflows/release.yml Outdated
Comment thread docker/services/ensadmin.yml Outdated
Comment thread scripts/sync-docker-services-tags.mjs Outdated

async function main() {
const versionFromArg = process.argv[2];
const version = versionFromArg ?? (await getVersionFromEnsapi());
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.

Why don't we make this whole file simpler by only accepting the version in the argument and then as part of the pnpm script we can pass it like so?

cat ./apps/ensapi/package.json | jq '.version' | node scripts/sync-docker-services-tags.mjs

also switch this file to .ts, ensure there's a tsconfig extending the base config in this package, and execute with tsx. then introduce a script in this package called sync-docker-services-version or docker:version:sync and call that script from the monorepo package.json instead of leaking internal details about this package at the monorepo root

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

hm, we might do that but I'm almost sure that jq isn't installed by default in workflow container, but I see your direction, let me see what I can do here

Copy link
Copy Markdown
Member Author

@sevenzing sevenzing Apr 29, 2026

Choose a reason for hiding this comment

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

decided to do it this way:

root package.json:

"docker:tag:sync": "node ./scripts/sync-docker-services-tags.mjs \"$(pnpm -F ensapi -s version:current)\"",

ensapi package.json:

"version:current": "node -p \"require('./package.json').version\""

Copy link
Copy Markdown
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@sevenzing Looks nice! Shared a few suggestions please feel welcome to take the lead to merge when you feel good 👍

Comment thread docker/envs/.env.docker.common
Comment thread docker/envs/.env.docker.common
Comment thread docker/envs/.env.docker.devnet Outdated
Comment thread docker/envs/.env.docker.devnet
Comment thread docker/envs/.env.docker.devnet Outdated
Comment thread docker/services/ensrainbow.yml
Comment thread package.json Outdated
Comment thread scripts/sync-docker-services-tags.mjs Outdated
Comment thread scripts/sync-docker-services-tags.mjs
Comment thread scripts/sync-docker-services-tags.mjs Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docker/envs/.env.docker.devnet`:
- Around line 4-18: The env file entries are out of order and failing
dotenv-linter; reorder the keys (PLUGINS, ENSINDEXER_SCHEMA_NAME, RPC_URL_1,
RPC_URL_15658733, LABEL_SET_ID, LABEL_SET_VERSION, DB_SCHEMA_VERSION) into the
project’s expected sorted order so dotenv-linter passes, keeping the existing
comments with their related keys and preserving values for keys like PLUGINS,
ENSINDEXER_SCHEMA_NAME, RPC_URL_1, RPC_URL_15658733, LABEL_SET_VERSION,
LABEL_SET_ID, and DB_SCHEMA_VERSION.

In `@scripts/sync-docker-services-tags.mjs`:
- Around line 36-48: The loop in scripts/sync-docker-services-tags.mjs writes
each file as it iterates which can leave partial updates if a later file fails;
change to a two-pass approach: first iterate serviceFiles and for each
absolutePath (using resolve(rootDir, relativePath)) readFile and validate
testPattern.match exists and compute the updated content (using
replacePattern/replacement) while collecting {absolutePath, previous, updated};
if any validation or I/O error occurs, throw before making any changes; only
after the full pass succeeds, iterate the collected updates and perform
writeFile for each and console.log the `"Updated ..."` messages.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 66c9f1fd-6197-4f62-8434-039049c8152d

📥 Commits

Reviewing files that changed from the base of the PR and between e41d950 and 34ec5cc.

📒 Files selected for processing (10)
  • .github/workflows/release.yml
  • apps/ensapi/package.json
  • docker/docker-compose.yml
  • docker/envs/.env.docker.devnet
  • docker/services/ensadmin.yml
  • docker/services/ensapi.yml
  • docker/services/ensindexer.yml
  • docker/services/ensrainbow.yml
  • package.json
  • scripts/sync-docker-services-tags.mjs

Comment on lines +4 to +18
# ENSIndexer
PLUGINS=subgraph,ensv2
# ENSIndexer and ENSApi
ENSINDEXER_SCHEMA_NAME=docker_devnet_v1
# ENSIndexer and ENSApi
RPC_URL_1=http://devnet:8545
# ENSIndexer and ENSRainbow
LABEL_SET_VERSION=0
# ENSIndexer and ENSRainbow
LABEL_SET_ID=ens-test-env
# ENSRainbow
DB_SCHEMA_VERSION=3
# TODO: in future we might migrate devnet to different chain_id like 1337 or 31337
# need to update this `RPC_URL_15658733` in that case
RPC_URL_15658733=http://devnet:8545
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Reorder these env keys before merging.

dotenv-linter is already flagging the new ordering here, so this file will keep failing lint until the entries are sorted into the project’s expected order.

🧰 Tools
🪛 dotenv-linter (4.0.0)

[warning] 7-7: [UnorderedKey] The ENSINDEXER_SCHEMA_NAME key should go before the PLUGINS key

(UnorderedKey)


[warning] 11-11: [UnorderedKey] The LABEL_SET_VERSION key should go before the PLUGINS key

(UnorderedKey)


[warning] 13-13: [UnorderedKey] The LABEL_SET_ID key should go before the LABEL_SET_VERSION key

(UnorderedKey)


[warning] 15-15: [UnorderedKey] The DB_SCHEMA_VERSION key should go before the ENSINDEXER_SCHEMA_NAME key

(UnorderedKey)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docker/envs/.env.docker.devnet` around lines 4 - 18, The env file entries are
out of order and failing dotenv-linter; reorder the keys (PLUGINS,
ENSINDEXER_SCHEMA_NAME, RPC_URL_1, RPC_URL_15658733, LABEL_SET_ID,
LABEL_SET_VERSION, DB_SCHEMA_VERSION) into the project’s expected sorted order
so dotenv-linter passes, keeping the existing comments with their related keys
and preserving values for keys like PLUGINS, ENSINDEXER_SCHEMA_NAME, RPC_URL_1,
RPC_URL_15658733, LABEL_SET_VERSION, LABEL_SET_ID, and DB_SCHEMA_VERSION.

Comment on lines +36 to +48
for (const relativePath of serviceFiles) {
const absolutePath = resolve(rootDir, relativePath);
const content = await readFile(absolutePath, "utf8");

if (!testPattern.test(content)) {
throw new Error(`Could not find ENSNODE_VERSION default expression in ${relativePath}`);
}

const previous = content.match(testPattern)[0];
const updated = content.replace(replacePattern, replacement);
await writeFile(absolutePath, updated, "utf8");
console.log(`Updated ${relativePath}:\t"${previous}" -> "${replacement}"`);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Avoid partial updates if a later file fails.

Each file is written immediately inside the loop, so a missing placeholder or I/O error on a later service file can leave earlier files already modified. For release automation, validate all targets first and only write after the full pass succeeds.

🔧 Suggested two-pass update
 async function updateServiceDefaultVersion(version) {
   const testPattern = /\$\{ENSNODE_VERSION:-[^}]+\}/;
   const replacePattern = /\$\{ENSNODE_VERSION:-[^}]+\}/g;
   const replacement = `\${ENSNODE_VERSION:-${version}}`;

-  console.log(`Updating service default tag to ${version}\n`);
-
+  const updates = [];
   for (const relativePath of serviceFiles) {
     const absolutePath = resolve(rootDir, relativePath);
     const content = await readFile(absolutePath, "utf8");

     if (!testPattern.test(content)) {
       throw new Error(`Could not find ENSNODE_VERSION default expression in ${relativePath}`);
     }

     const previous = content.match(testPattern)[0];
-    const updated = content.replace(replacePattern, replacement);
-    await writeFile(absolutePath, updated, "utf8");
-    console.log(`Updated ${relativePath}:\t"${previous}" -> "${replacement}"`);
+    updates.push({
+      absolutePath,
+      relativePath,
+      previous,
+      updated: content.replace(replacePattern, replacement),
+    });
+  }
+
+  console.log(`Updating service default tag to ${version}\n`);
+  for (const { absolutePath, relativePath, previous, updated } of updates) {
+    await writeFile(absolutePath, updated, "utf8");
+    console.log(`Updated ${relativePath}:\t"${previous}" -> "${replacement}"`);
   }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/sync-docker-services-tags.mjs` around lines 36 - 48, The loop in
scripts/sync-docker-services-tags.mjs writes each file as it iterates which can
leave partial updates if a later file fails; change to a two-pass approach:
first iterate serviceFiles and for each absolutePath (using resolve(rootDir,
relativePath)) readFile and validate testPattern.match exists and compute the
updated content (using replacePattern/replacement) while collecting
{absolutePath, previous, updated}; if any validation or I/O error occurs, throw
before making any changes; only after the full pass succeeds, iterate the
collected updates and perform writeFile for each and console.log the `"Updated
..."` messages.

@sevenzing sevenzing merged commit a51990a into main Apr 29, 2026
20 checks passed
@sevenzing sevenzing deleted the ll/docker-v2 branch April 29, 2026 17:13
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.

3 participants