-
Notifications
You must be signed in to change notification settings - Fork 2
chore: Update docs workflow to sync docker-compose #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ce documentation generation
…and update documentation
❌ Deploy Preview for genlayer-docs failed. Why did it fail? →
|
WalkthroughReplaces Python-based config sanitization with yq/shell scripts, adds Docker Compose as a new sync type (workflow matrix, sparse-checkout, sanitize & temp-file prepare/cleanup steps), introduces docker-compose content and update tooling, and updates docs and npm scripts to incorporate the new flow. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Developer
participant GH_WF as "GitHub Actions (sync-docs-from-node)"
participant Composite as "sync-files composite action"
participant Sanitizers as "sanitize-config.sh / sanitize-docker-compose.sh"
participant Repo as "Repo (release/* → content/* / temp dirs)"
Developer->>GH_WF: push / schedule (matrix includes docker_compose)
GH_WF->>Composite: run sync step (sync_type=docker_compose)
Composite->>Repo: sparse-checkout release/docker-compose.yaml
Composite->>Sanitizers: copy & sanitize → write DOCKER_COMPOSE_SOURCE (temp)
Sanitizers->>Repo: write sanitized temp file
Composite->>Repo: rsync DOCKER_COMPOSE_SOURCE → content/validators/docker-compose.yaml
Composite->>Repo: cleanup temp docker-compose dir
GH_WF->>Developer: open PR with aggregated summary (includes Docker Compose)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/sync-docs-from-node.yml (1)
331-346: Consider removing--allflag from selective git staging command.The
commit_and_push_changesfunction ingit-utils.sh(line 47) usesgit add --all content/validators pages/api-references pages/validators, but based on your established preference from PR #257, the selective staging should begit add content/validators pages/api-references pages/validatorswithout the--allflag. The--allflag stages deletions across the entire working directory, which contradicts the selective staging approach intended to avoid staging unintended changes.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
.github/actions/sync-files/action.yml(2 hunks).github/scripts/doc-generator.sh(1 hunks).github/scripts/sanitize-config.py(0 hunks).github/scripts/sanitize-config.sh(0 hunks).github/scripts/sanitize-docker-compose.sh(1 hunks).github/workflows/README.md(5 hunks).github/workflows/sync-docs-from-node.yml(5 hunks)README.md(1 hunks)content/validators/docker-compose.yaml(1 hunks)package.json(1 hunks)pages/validators/setup-guide.mdx(0 hunks)scripts/README.md(1 hunks)scripts/update-docker-compose-in-setup-guide.js(1 hunks)
💤 Files with no reviewable changes (3)
- pages/validators/setup-guide.mdx
- .github/scripts/sanitize-config.sh
- .github/scripts/sanitize-config.py
🧰 Additional context used
📓 Path-based instructions (1)
scripts/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Scripts for build-time generation are located in the scripts/ directory
Files:
scripts/update-docker-compose-in-setup-guide.jsscripts/README.md
🧠 Learnings (19)
📓 Common learnings
Learnt from: dohernandez
Repo: genlayerlabs/genlayer-docs PR: 257
File: .github/workflows/sync-docs-from-node.yml:0-0
Timestamp: 2025-07-26T13:26:45.588Z
Learning: In the sync-docs-from-node.yml workflow, the user prefers selective git staging with `git add content/validators pages/api-references pages/validators` rather than `git add -A` to avoid staging unintended changes, as these are the expected directories to be modified during the documentation sync process.
Learnt from: dohernandez
Repo: genlayerlabs/genlayer-docs PR: 308
File: pages/validators/setup-guide.mdx:790-790
Timestamp: 2025-12-03T17:07:37.200Z
Learning: In pages/validators/setup-guide.mdx: When documenting docker-compose setup, users must create genvm-module-web-docker.yaml (separate from the tarball's genvm-module-web.yaml) to point the webdriver URL to the docker service name (http://webdriver-container:4444) instead of localhost, as the tarball version is configured for binary execution with localhost.
📚 Learning: 2025-12-03T17:07:37.200Z
Learnt from: dohernandez
Repo: genlayerlabs/genlayer-docs PR: 308
File: pages/validators/setup-guide.mdx:790-790
Timestamp: 2025-12-03T17:07:37.200Z
Learning: In pages/validators/setup-guide.mdx: When documenting docker-compose setup, users must create genvm-module-web-docker.yaml (separate from the tarball's genvm-module-web.yaml) to point the webdriver URL to the docker service name (http://webdriver-container:4444) instead of localhost, as the tarball version is configured for binary execution with localhost.
Applied to files:
scripts/update-docker-compose-in-setup-guide.jscontent/validators/docker-compose.yaml.github/workflows/README.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Applied to files:
scripts/update-docker-compose-in-setup-guide.js.github/workflows/README.mdscripts/README.mdREADME.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Applied to files:
scripts/update-docker-compose-in-setup-guide.jsscripts/README.mdREADME.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in setup-guide.mdx when new features are added to existing commands
Applied to files:
scripts/update-docker-compose-in-setup-guide.jsscripts/README.mdREADME.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update configuration examples with new contract addresses in setup-guide.mdx when applicable
Applied to files:
scripts/update-docker-compose-in-setup-guide.jsREADME.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Applied to files:
scripts/update-docker-compose-in-setup-guide.jsscripts/README.mdREADME.md
📚 Learning: 2025-08-19T21:48:24.895Z
Learnt from: epsjunior
Repo: genlayerlabs/genlayer-docs PR: 278
File: components/copy-page.tsx:0-0
Timestamp: 2025-08-19T21:48:24.895Z
Learning: In the genlayer-docs project, markdown files are generated during the build process via `npm run sync-mdx`. If markdown generation fails, the entire deployment process fails, ensuring that markdown files will always exist in production environments.
Applied to files:
package.json.github/workflows/README.mdscripts/README.md
📚 Learning: 2025-08-19T22:01:32.272Z
Learnt from: epsjunior
Repo: genlayerlabs/genlayer-docs PR: 278
File: scripts/process-mdx-to-md.js:150-184
Timestamp: 2025-08-19T22:01:32.272Z
Learning: In the genlayer-docs project build process, epsjunior prefers to let file operations in build scripts fail fast with natural Node.js errors rather than adding graceful error handling, to ensure build integrity and prevent incomplete builds from proceeding.
Applied to files:
package.json
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)
Applied to files:
package.json.github/workflows/README.mdscripts/README.md.github/scripts/doc-generator.sh
📚 Learning: 2025-08-21T17:36:07.724Z
Learnt from: epsjunior
Repo: genlayerlabs/genlayer-docs PR: 285
File: scripts/list-docs-routes.js:24-26
Timestamp: 2025-08-21T17:36:07.724Z
Learning: In the genlayer-docs project, the route discovery script (scripts/list-docs-routes.js) intentionally limits traversal to directories containing _meta.json files to ensure tests mirror the actual site navigation behavior and avoid testing draft content that isn't part of the public navigation structure.
Applied to files:
package.jsonscripts/README.md
📚 Learning: 2025-07-26T13:26:45.588Z
Learnt from: dohernandez
Repo: genlayerlabs/genlayer-docs PR: 257
File: .github/workflows/sync-docs-from-node.yml:0-0
Timestamp: 2025-07-26T13:26:45.588Z
Learning: In the sync-docs-from-node.yml workflow, the user prefers selective git staging with `git add content/validators pages/api-references pages/validators` rather than `git add -A` to avoid staging unintended changes, as these are the expected directories to be modified during the documentation sync process.
Applied to files:
.github/workflows/README.md.github/workflows/sync-docs-from-node.yml
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-sitemap-xml.js : Build process includes automatic generation of sitemap (scripts/generate-sitemap-xml.js)
Applied to files:
.github/workflows/README.mdscripts/README.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/**/* : Scripts for build-time generation are located in the scripts/ directory
Applied to files:
scripts/README.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
Applied to files:
README.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : GenVM diagnostics integration affects the doctor command behavior and should be documented in the validator setup guide
Applied to files:
README.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update genesis block configuration in consensus section of setup-guide.mdx when network upgrades occur
Applied to files:
README.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update consensus contract addresses and genesis block number in setup-guide.mdx when network upgrades occur
Applied to files:
README.md
📚 Learning: 2025-07-14T09:14:00.225Z
Learnt from: dohernandez
Repo: genlayerlabs/genlayer-docs PR: 245
File: .github/workflows/sync-docs-from-node.yml:69-72
Timestamp: 2025-07-14T09:14:00.225Z
Learning: The correct parameter name for enabling cone mode in sparse checkout for actions/checkoutv4 is `sparse-checkout-cone-mode` (not `sparse-checkout-cone`). This parameter should be set to `true` to enable cone mode for directory-based sparse checkout optimization.
Applied to files:
.github/workflows/sync-docs-from-node.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Generate Documentation
- GitHub Check: Redirect rules - genlayer-docs
- GitHub Check: Header rules - genlayer-docs
- GitHub Check: Pages changed - genlayer-docs
- GitHub Check: Playwright E2E
🔇 Additional comments (13)
README.md (1)
74-89: Validator setup guide update section looks consistentThe new section correctly documents the three setup-guide update scripts and points readers to
scripts/README.md; commands and paths match the actual scripts..github/scripts/doc-generator.sh (1)
41-48: New docker-compose step integrates cleanly into doc generation flowThe
node-update-docker-composestep mirrors existing steps and correctly participates in the sharedfailedflag, so any non-zero exit will surface in the final status..github/scripts/sanitize-docker-compose.sh (1)
1-26: Sanitization script is simple and robust for the intended useArgument/file checks plus the
sedrange delete from# Grafana Alloyto EOF match the stated goal of stripping the alloy-related tail for docs.package.json (1)
6-8: npm script wiring for docker-compose updates is correct
node-update-docker-composeis correctly defined and integrated into bothdevandbuildpipelines immediately afternode-update-config, keeping the setup guide aligned withcontent/validators/docker-compose.yaml.Also applies to: 14-15
content/validators/docker-compose.yaml (1)
1-42: Docker Compose definition aligns with validator/docker-genvm guidanceThe compose file cleanly defines
webdriver-containerandgenlayer-node, usesgenvm-module-web-docker.yamlfor the GenVM config, and exposes webdriver via the docker service, matching the documented docker-compose setup expectations. Based on learnings, this is the expected pattern for the validator guide..github/workflows/README.md (1)
15-18: Documentation accurately reflects docker_compose integration.The README.md comprehensively documents the new sync type, file structure, sanitization process, and npm script. All sections are logically organized and consistent with the PR changes.
Also applies to: 117-118, 175-180, 232-233
.github/workflows/sync-docs-from-node.yml (7)
95-95: Matrix integration is clean and logical.The docker_compose type is properly added to the matrix strategy alongside existing types.
Also applies to: 95-95
109-115: Sparse-checkout configuration is correct.The
release/docker-compose.yamlpath is properly added andsparse-checkout-cone-mode: trueuses the correct parameter name.
133-138: Parameter setup for docker_compose is correctly structured.Follows the established pattern for single-file syncs and matches the documented source/target paths.
397-405: PR body correctly includes docker-compose update script.The
npm run node-update-docker-composescript is properly listed in the automated process checklist at line 403.
471-471: Summary loop properly includes docker_compose sync reporting.The docker_compose type is integrated into the summary report loop with appropriate title and emoji mapping at line 476.
Also applies to: 476-476
267-271: No action needed. The.github/scripts/doc-generator.shscript properly invokesnpm run node-update-docker-composeat lines 41-48 with appropriate error handling and status reporting. The workflow integration is correctly implemented.
159-167: Sanitization properly integrated in composite action.The composite action correctly handles sanitization for docker_compose type. The
.github/actions/sync-files/action.ymlcontains a dedicated "Prepare docker-compose file" step that detectsdocker_composetype and explicitly invokes.github/scripts/sanitize-docker-compose.shon the source file before syncing. This internal handling justifies the removal of the explicitsanitize_scriptinput parameter.
| - name: Prepare docker-compose file | ||
| if: inputs.type == 'docker_compose' | ||
| shell: bash | ||
| run: | | ||
| # For docker_compose type, handle special case: | ||
| # Copy and sanitize (remove alloy service and volumes) | ||
| if [[ -f "${{ inputs.source_path }}" ]]; then | ||
| # Create temp directory | ||
| TEMP_DIR=$(mktemp -d) | ||
| echo "TEMP_DOCKER_COMPOSE_DIR=$TEMP_DIR" >> $GITHUB_ENV | ||
| # Copy docker-compose.yaml | ||
| cp "${{ inputs.source_path }}" "$TEMP_DIR/docker-compose.yaml" | ||
| # Sanitize: remove alloy service and volumes section using yq | ||
| bash .github/scripts/sanitize-docker-compose.sh "$TEMP_DIR/docker-compose.yaml" | ||
| # Update source path for sync | ||
| echo "DOCKER_COMPOSE_SOURCE=$TEMP_DIR/docker-compose.yaml" >> $GITHUB_ENV | ||
| else | ||
| echo "Docker compose source file not found: ${{ inputs.source_path }}" | ||
| exit 1 | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update stale comment about docker-compose sanitization implementation
The docker-compose prep step calls .github/scripts/sanitize-docker-compose.sh, which uses sed, but the comment still says “using yq”.
You can align the comment with the implementation:
- # Sanitize: remove alloy service and volumes section using yq
+ # Sanitize: remove alloy service and volumes section using the sanitize-docker-compose.sh script📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Prepare docker-compose file | |
| if: inputs.type == 'docker_compose' | |
| shell: bash | |
| run: | | |
| # For docker_compose type, handle special case: | |
| # Copy and sanitize (remove alloy service and volumes) | |
| if [[ -f "${{ inputs.source_path }}" ]]; then | |
| # Create temp directory | |
| TEMP_DIR=$(mktemp -d) | |
| echo "TEMP_DOCKER_COMPOSE_DIR=$TEMP_DIR" >> $GITHUB_ENV | |
| # Copy docker-compose.yaml | |
| cp "${{ inputs.source_path }}" "$TEMP_DIR/docker-compose.yaml" | |
| # Sanitize: remove alloy service and volumes section using yq | |
| bash .github/scripts/sanitize-docker-compose.sh "$TEMP_DIR/docker-compose.yaml" | |
| # Update source path for sync | |
| echo "DOCKER_COMPOSE_SOURCE=$TEMP_DIR/docker-compose.yaml" >> $GITHUB_ENV | |
| else | |
| echo "Docker compose source file not found: ${{ inputs.source_path }}" | |
| exit 1 | |
| fi | |
| - name: Prepare docker-compose file | |
| if: inputs.type == 'docker_compose' | |
| shell: bash | |
| run: | | |
| # For docker_compose type, handle special case: | |
| # Copy and sanitize (remove alloy service and volumes) | |
| if [[ -f "${{ inputs.source_path }}" ]]; then | |
| # Create temp directory | |
| TEMP_DIR=$(mktemp -d) | |
| echo "TEMP_DOCKER_COMPOSE_DIR=$TEMP_DIR" >> $GITHUB_ENV | |
| # Copy docker-compose.yaml | |
| cp "${{ inputs.source_path }}" "$TEMP_DIR/docker-compose.yaml" | |
| # Sanitize: remove alloy service and volumes section using the sanitize-docker-compose.sh script | |
| bash .github/scripts/sanitize-docker-compose.sh "$TEMP_DIR/docker-compose.yaml" | |
| # Update source path for sync | |
| echo "DOCKER_COMPOSE_SOURCE=$TEMP_DIR/docker-compose.yaml" >> $GITHUB_ENV | |
| else | |
| echo "Docker compose source file not found: ${{ inputs.source_path }}" | |
| exit 1 | |
| fi |
🤖 Prompt for AI Agents
.github/actions/sync-files/action.yml around lines 62 to 86: the block preparing
the docker-compose file claims it "Sanitize: remove alloy service and volumes
section using yq" but the actual script
.github/scripts/sanitize-docker-compose.sh uses sed; update the comment to
correctly state that the sanitize script uses sed (or a shell stream-edit)
instead of yq, keeping the rest of the logic unchanged so the comment accurately
reflects the implementation.
| ## Other Scripts | ||
|
|
||
| | Script | Description | | ||
| |--------|-------------| | ||
| | `generate-full-docs.js` | Concatenates all MDX files into a single documentation file | | ||
| | `generate-sitemap-xml.js` | Generates `sitemap.xml` from all MDX files | | ||
| | `generate-changelog.js` | Generates the changelog page from individual version files | | ||
| | `generate-node-api-docs.js` | Generates API documentation and navigation | | ||
| | `sync-meta-files.js` | Synchronizes `_meta.json` files with actual content | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix script name in “Other Scripts” table
The table lists generate-node-api-docs.js, but package.json runs node scripts/generate-api-docs.js for API docs. This mismatch can confuse contributors.
Consider updating the entry:
-| `generate-node-api-docs.js` | Generates API documentation and navigation |
+| `generate-api-docs.js` | Generates API documentation and navigation |📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ## Other Scripts | |
| | Script | Description | | |
| |--------|-------------| | |
| | `generate-full-docs.js` | Concatenates all MDX files into a single documentation file | | |
| | `generate-sitemap-xml.js` | Generates `sitemap.xml` from all MDX files | | |
| | `generate-changelog.js` | Generates the changelog page from individual version files | | |
| | `generate-node-api-docs.js` | Generates API documentation and navigation | | |
| | `sync-meta-files.js` | Synchronizes `_meta.json` files with actual content | | |
| ## Other Scripts | |
| | Script | Description | | |
| |--------|-------------| | |
| | `generate-full-docs.js` | Concatenates all MDX files into a single documentation file | | |
| | `generate-sitemap-xml.js` | Generates `sitemap.xml` from all MDX files | | |
| | `generate-changelog.js` | Generates the changelog page from individual version files | | |
| | `generate-api-docs.js` | Generates API documentation and navigation | | |
| | `sync-meta-files.js` | Synchronizes `_meta.json` files with actual content | |
🤖 Prompt for AI Agents
In scripts/README.md around lines 65 to 73, the table entry for the API docs
script uses the wrong filename (`generate-node-api-docs.js`) which doesn't match
package.json; update that table row to use the actual script name
`generate-api-docs.js` (or, if package.json is wrong, align package.json
instead), and keep the description as "Generates API documentation and
navigation" so the README and package.json are consistent.
| if (!fs.existsSync(dockerComposePath)) { | ||
| console.error(`Docker compose file ${dockerComposePath} does not exist`); | ||
| return; | ||
| } | ||
|
|
||
| if (!fs.existsSync(setupGuidePath)) { | ||
| console.error(`Setup guide file ${setupGuidePath} does not exist`); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the script fails the build when docker-compose update cannot run
Right now, missing files or failure to find the docker-compose block only log to stderr and then return, so the process exits with code 0. Because this script is part of the doc-generation and build chains, that can leave the setup guide out of sync while CI still passes. Based on learnings, build-time scripts here are expected to fail fast instead of silently skipping work.
Consider exiting with a non-zero status on unrecoverable errors:
if (!fs.existsSync(dockerComposePath)) {
console.error(`Docker compose file ${dockerComposePath} does not exist`);
- return;
+ process.exit(1);
}
if (!fs.existsSync(setupGuidePath)) {
console.error(`Setup guide file ${setupGuidePath} does not exist`);
- return;
+ process.exit(1);
}
@@
} else {
- console.error('Could not find docker-compose pattern in setup guide');
+ console.error('Could not find docker-compose pattern in setup guide');
@@
if (!found) {
- console.error('Could not find docker-compose YAML block in setup guide');
+ console.error('Could not find docker-compose YAML block in setup guide');
+ process.exit(1);
}
}This way, npm run node-update-docker-compose will fail loudly if the expected section or files are missing, and the higher-level workflows (doc-generator.sh, dev/build scripts, CI) will correctly surface the problem.
Also applies to: 45-47, 71-73
🤖 Prompt for AI Agents
In scripts/update-docker-compose-in-setup-guide.js around lines 14-22 (and
similarly at 45-47 and 71-73), the script currently logs errors and returns when
files or expected sections are missing which leaves the process exiting with
code 0; change these early-return error paths to call process.exit(1) (or throw
an Error) after logging a clear message so the script fails fast and returns a
non-zero exit code when the docker-compose file, the setup guide, or the
docker-compose block cannot be found or updated, ensuring CI/doc-generation
detects the failure.
- Add sanitize-config.sh using yq to replace RPC URLs and remove node.dev - Update docker-compose sanitization to use yq + sed - Install yq in workflow for both config and docker_compose sync types - Update README with sanitization documentation
f0af425 to
7bdc20e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
.github/actions/sync-files/action.yml (1)
80-81: Update stale comment to accurately describe sanitization method.The comment on line 80 states "using yq" but
.github/scripts/sanitize-docker-compose.shuses bothyqandsed. Update the comment to reflect the actual implementation.- # Sanitize: remove alloy service and volumes section using yq + # Sanitize: remove alloy service and volumes section using the sanitize-docker-compose.sh script
🧹 Nitpick comments (1)
.github/scripts/sanitize-docker-compose.sh (1)
26-27: Sed pattern for alloy comment cleanup could be fragile with non-standard YAML structures.The pattern
/# Grafana Alloy/,/^[^ #]/{ /^[^ #]/!d }on line 26 assumes comments follow a specific structure (comments before the next service definition). If the source docker-compose.yaml has alloy comments in unexpected locations or with different formatting, the cleanup may not work as intended.Consider adding a fallback or logging to verify what was actually removed. Alternatively, document the expected format assumption clearly in the script header.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/actions/sync-files/action.yml(2 hunks).github/scripts/sanitize-config.sh(2 hunks).github/scripts/sanitize-docker-compose.sh(1 hunks).github/workflows/README.md(5 hunks).github/workflows/sync-docs-from-node.yml(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/scripts/sanitize-config.sh
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: dohernandez
Repo: genlayerlabs/genlayer-docs PR: 257
File: .github/workflows/sync-docs-from-node.yml:0-0
Timestamp: 2025-07-26T13:26:45.588Z
Learning: In the sync-docs-from-node.yml workflow, the user prefers selective git staging with `git add content/validators pages/api-references pages/validators` rather than `git add -A` to avoid staging unintended changes, as these are the expected directories to be modified during the documentation sync process.
📚 Learning: 2025-07-26T13:26:45.588Z
Learnt from: dohernandez
Repo: genlayerlabs/genlayer-docs PR: 257
File: .github/workflows/sync-docs-from-node.yml:0-0
Timestamp: 2025-07-26T13:26:45.588Z
Learning: In the sync-docs-from-node.yml workflow, the user prefers selective git staging with `git add content/validators pages/api-references pages/validators` rather than `git add -A` to avoid staging unintended changes, as these are the expected directories to be modified during the documentation sync process.
Applied to files:
.github/workflows/README.md.github/workflows/sync-docs-from-node.yml
📚 Learning: 2025-08-19T21:48:24.895Z
Learnt from: epsjunior
Repo: genlayerlabs/genlayer-docs PR: 278
File: components/copy-page.tsx:0-0
Timestamp: 2025-08-19T21:48:24.895Z
Learning: In the genlayer-docs project, markdown files are generated during the build process via `npm run sync-mdx`. If markdown generation fails, the entire deployment process fails, ensuring that markdown files will always exist in production environments.
Applied to files:
.github/workflows/README.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)
Applied to files:
.github/workflows/README.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Applied to files:
.github/workflows/README.md
📚 Learning: 2025-12-03T17:07:37.200Z
Learnt from: dohernandez
Repo: genlayerlabs/genlayer-docs PR: 308
File: pages/validators/setup-guide.mdx:790-790
Timestamp: 2025-12-03T17:07:37.200Z
Learning: In pages/validators/setup-guide.mdx: When documenting docker-compose setup, users must create genvm-module-web-docker.yaml (separate from the tarball's genvm-module-web.yaml) to point the webdriver URL to the docker service name (http://webdriver-container:4444) instead of localhost, as the tarball version is configured for binary execution with localhost.
Applied to files:
.github/workflows/README.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/**/* : Scripts for build-time generation are located in the scripts/ directory
Applied to files:
.github/workflows/README.md
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-sitemap-xml.js : Build process includes automatic generation of sitemap (scripts/generate-sitemap-xml.js)
Applied to files:
.github/workflows/README.md
📚 Learning: 2025-07-14T09:14:00.225Z
Learnt from: dohernandez
Repo: genlayerlabs/genlayer-docs PR: 245
File: .github/workflows/sync-docs-from-node.yml:69-72
Timestamp: 2025-07-14T09:14:00.225Z
Learning: The correct parameter name for enabling cone mode in sparse checkout for actions/checkoutv4 is `sparse-checkout-cone-mode` (not `sparse-checkout-cone`). This parameter should be set to `true` to enable cone mode for directory-based sparse checkout optimization.
Applied to files:
.github/workflows/sync-docs-from-node.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Playwright E2E
- GitHub Check: Redirect rules - genlayer-docs
- GitHub Check: Header rules - genlayer-docs
- GitHub Check: Pages changed - genlayer-docs
🔇 Additional comments (7)
.github/scripts/sanitize-docker-compose.sh (1)
1-29: Script structure and error handling are sound.The use of
set -e, input validation, and clear error messages make this a robust utility. The yq-based service/volumes removal is the correct approach for YAML manipulation..github/actions/sync-files/action.yml (1)
65-88: Docker-compose preparation and cleanup steps are well-structured.The new docker-compose flow mirrors the config flow with proper temporary directory handling, yq installation conditional (shared with config), and cleanup using
always()condition. Variable propagation (DOCKER_COMPOSE_SOURCE) is correctly handled for use in the sync step.Also applies to: 119-125
.github/workflows/README.md (1)
15-21: Workflow documentation properly reflects docker-compose integration.The README updates are comprehensive and accurate. The file structure examples, sanitization documentation, and npm script references all align with the workflow implementation. The "6 sync types" count, sparse-checkout configuration, and sanitization details are properly documented.
Also applies to: 103-119, 175-187, 240-240
.github/workflows/sync-docs-from-node.yml (4)
95-95: Docker-compose matrix addition and sparse-checkout configuration are correct.The workflow properly adds docker_compose to the sync matrix, installs yq conditionally for config/docker_compose types, and includes
release/docker-compose.yamlin sparse-checkout with cone-mode enabled. This follows the established patterns in the workflow.Also applies to: 103-107, 118-119
139-143: Docker-compose sync parameters are properly configured.The new case block correctly sets title, source/target paths, and filter pattern, mirroring the structure of other sync types. The absence of
sanitize_scriptparameter is correct since sanitization is now handled within the action for this type.
1-548: Overall workflow structure and integration are sound.The docker-compose sync type is consistently integrated across the workflow matrix, sparse-checkout configuration, parameter setting, documentation generation, PR creation, and summary reporting. The workflow maintains the selective directory sync approach that avoids unintended changes, aligning with established preferences.
409-409: PR body and summary generation properly integrated with docker-compose type.The npm script
node-update-docker-composeis correctly defined inpackage.jsonand the supporting scriptscripts/update-docker-compose-in-setup-guide.jsexists. The addition to the documented script list in the PR body and the summary section with docker_compose and emoji (🐳) maintains consistency with other sync types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also copy release/.env.example so that the env vars referenced here make sense to the users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I plan to do it in another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why delete the alloy configuration? I understand that we want telemetry from all users, I wouldn't remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it is not shown in the validator guide, here we only store what is shown there. The day we start showing it, we add it, or we remove the removal
Description
This PR enhances the GitHub workflow to sync docker-compose.yaml from the genlayer-node repository, adds a new script to update the docker-compose example in the setup guide, and improves documentation for the existing scripts. It also removes the now-unnecessary config sanitization scripts since the source config is already sanitized.
Key Changes
docker_composesync type to the workflow matrix that syncsrelease/docker-compose.yamlfrom genlayer-node tocontent/validators/docker-compose.yamlsanitize-docker-compose.shscript usingsedto remove the alloy service and volumes section from the synced docker-compose fileupdate-docker-compose-in-setup-guide.jsto inject docker-compose content into setup-guide.mdxscripts/README.mddocumenting all update scripts and updated the main README with usage instructionssanitize-config.shandsanitize-config.pyas they are no longer neededFiles Changed
.github/workflows/sync-docs-from-node.yml.github/actions/sync-files/action.yml.github/scripts/sanitize-docker-compose.sh.github/scripts/doc-generator.shscripts/update-docker-compose-in-setup-guide.jsscripts/README.mdcontent/validators/docker-compose.yamlpackage.jsonnode-update-docker-composenpm scriptREADME.mdTypes of Changes
Checklist:
Summary by CodeRabbit
New Features
Refactor
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.