Skip to content

hotfix: Add ENVIRONMENT_ID for workspace-supervisor test - #60

Merged
VAIBHAVSING merged 6 commits into
mainfrom
hotfix/supervisor-env-var
Oct 26, 2025
Merged

hotfix: Add ENVIRONMENT_ID for workspace-supervisor test#60
VAIBHAVSING merged 6 commits into
mainfrom
hotfix/supervisor-env-var

Conversation

@VAIBHAVSING

@VAIBHAVSING VAIBHAVSING commented Oct 26, 2025

Copy link
Copy Markdown
Owner

Fixes the CI test failure where workspace-supervisor --version requires ENVIRONMENT_ID environment variable. Added -e ENVIRONMENT_ID=ci-test to the docker run command in the workflow test step.

Summary by CodeRabbit

  • Chores
    • Streamlined Docker production build pipeline to use a consolidated multi-stage workflow for improved efficiency.
    • Enhanced CI/CD automation with centralized image building, security scanning, and deployment reporting.
    • Optimized build process with updated trigger conditions and refined deployment summaries.

- Add push_to_dockerhub input for workflow_dispatch
- Set force_rebuild default to true for manual triggers
- Use fallback DockerHub username (vaibhavsing) if secret not set
- Add conditional push logic based on input
- Fix all image build/push steps to use dynamic username
- Remove unused dockerhub_username output from setup job
- Create Dockerfile.production with all 4 layers as multi-stage build
- Update docker-cd-production.yml workflow to build and push only final image
- Workflow builds: supervisor, base, languages, vscode, and ai-tools layers
- Only final workspace image (vaibhavsing/dev8-workspace) pushed to Docker Hub
- Added comprehensive testing for all components
- Added security scanning with Trivy
- Local development: cd docker && make build-all && docker compose up -d
@coderabbitai

coderabbitai Bot commented Oct 26, 2025

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@VAIBHAVSING has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 8 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ddaac45 and 9080332.

📒 Files selected for processing (1)
  • .github/workflows/docker-cd-production.yml (1 hunks)

Walkthrough

The pull request consolidates the Docker production CI/CD pipeline from multiple jobs into a single multi-stage build workflow and introduces a comprehensive multi-stage Dockerfile that builds a complete development environment with supervisor, language runtimes, VS Code server, and AI tools.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow Refactoring
\.github/workflows/docker-cd-production\.yml
Replaces multi-job pipeline (setup, build-base, build-languages, build-vscode, build-ai-tools) with single build-and-push job using multi-stage Docker build. Updates triggers to watch main and production branches; adds push_to_dockerhub workflow input; introduces Docker Buildx setup, metadata-driven tagging, Trivy security scanning, and PR comment reporting. Adjusts concurrency to include branch reference and enable cancel-in-progress.
Production Multi-Stage Dockerfile
docker/Dockerfile\.production
New file: comprehensive multi-stage production image with 5 stages—Go supervisor builder, hardened Ubuntu 22.04 base with SSH/sudoers, language runtimes (Node.js, Python, Go, Rust, Bun), VS Code Server, and AI tools (GitHub CLI, Azure CLI). Includes dev8 user creation, health checks, exposed ports (8080, 2222, 9000), and entrypoint script.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant GitHub as GitHub Event
    participant Workflow as docker-cd-production
    participant Buildx as Docker Buildx
    participant Registry as Docker Hub
    participant Trivy as Trivy Scanner
    participant PR as PR Comments

    GitHub->>Workflow: Trigger (push/PR on main/production)
    Workflow->>Buildx: Setup Docker Buildx
    Workflow->>Workflow: Generate version metadata
    Workflow->>Buildx: Build multi-stage image<br/>(supervisor → base → languages → vscode → ai-tools)
    Buildx-->>Workflow: Image built & tagged
    Workflow->>Trivy: Security scan workspace image
    Trivy-->>Workflow: Scan results
    alt Event is PR
        Workflow->>PR: Post build summary comment
    end
    alt Event is push to main/production<br/>and push_to_dockerhub is true
        Workflow->>Registry: Push tagged image to Docker Hub
        Registry-->>Workflow: Image published
    end
    Workflow-->>Workflow: Generate deployment summary
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Workflow refactoring: Significant restructuring from multi-job to single-job architecture with new conditional logic, metadata-driven tagging, and PR commenting requires careful review of trigger conditions and concurrency behavior.
  • Multi-stage Dockerfile complexity: Five interconnected stages with diverse tooling (Go, Python, Node.js, Rust, etc.), SSH hardening, and user configuration demand verification of layer dependencies and security settings.
  • Integration points: New Trivy scanning step, Docker Buildx configuration, and conditional push logic need verification for correctness across different event types (push vs. PR).

Possibly related PRs

Poem

🐰 Five stages dance in Docker's hall,
A supervisor leads them all,
From Go to Python, Rust to Node,
One build now lights the coding road,
Multi-stage magic, streamlined and tall!

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The pull request title claims the change is a hotfix that adds ENVIRONMENT_ID for workspace-supervisor testing, but the raw summary reveals the actual changeset consists of a comprehensive refactoring of the Docker CD production workflow and the introduction of an entirely new multi-stage Dockerfile. The title describes only a minor environment variable addition, which is fundamentally misaligned with the extensive pipeline restructuring and Dockerfile consolidation that constitute the main changes. This creates a significant discrepancy between what the title indicates and what the changeset actually delivers.
Description Check ⚠️ Warning The pull request description is minimal and largely incomplete compared to the provided template. While it provides a brief explanation of the stated purpose (adding ENVIRONMENT_ID), it lacks all major template sections including Type of Change checkboxes, Related Issue reference, Testing section, Screenshots/Videos, comprehensive Checklist, and Environment Tested details. Additionally, the description does not reflect the full scope of changes evident in the raw summary, which includes major workflow restructuring and a new Dockerfile—suggesting either a description mismatch or incomplete context. The minimal content fails to meet the template's structural and informational requirements.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.

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

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

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 5

🧹 Nitpick comments (1)
.github/workflows/docker-cd-production.yml (1)

102-114: Inefficient image rebuild: Build step loads image, but push step rebuilds it.

The workflow builds the image with load: true at line 102-114 for local inspection, then rebuilds the entire image again at line 148-163 for pushing to Docker Hub. This doubles build time and cache usage.

Consider using Docker Buildx bake or multi-target builds to reuse layers, or remove the intermediate load step if you're not running tests.

Also applies to: 148-163

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4add342 and ddaac45.

📒 Files selected for processing (2)
  • .github/workflows/docker-cd-production.yml (1 hunks)
  • docker/Dockerfile.production (1 hunks)
🔇 Additional comments (7)
.github/workflows/docker-cd-production.yml (5)

28-35: Approve workflow dispatch input logic.

The push_to_dockerhub input allows manual control over Docker Hub pushes (lines 28-35), with sensible default ('true') and type validation (choice between 'true'/'false'). The conditional logic at lines 149-152 correctly uses this input. Good design.


41-43: Approve concurrency configuration.

The concurrency group includes the branch reference (line 42), and cancel-in-progress: true is enabled (line 43). This correctly prevents workflow queue buildup and ensures only the latest push per branch runs. Good practice.


83-100: Approve metadata action configuration.

The Docker metadata action is well-configured with:

  • Multiple tag types (branch, PR, semver, sha, latest)
  • OCI labels (title, description, vendor, version)
  • Proper image reference from environment variable

This creates a comprehensive, maintainable image versioning strategy.


119-134: Approve security scanning and SARIF upload.

Trivy security scanning is well-integrated:

  • Filters for CRITICAL and HIGH severity only (good signal-to-noise)
  • Includes os and library vulnerability types
  • Sets reasonable 15m timeout
  • Properly uploads SARIF to GitHub Security tab with category

This provides valuable supply-chain security insights.


116-117: The review comment's core premise is incorrect—the PR removes the test, not adds it.

The git diff shows the PR removes the entire "Test final workspace image" step (which contained -e ENVIRONMENT_ID=ci-test) and replaces it with a comment explaining why tests are skipped. The review comment incorrectly states the PR "adds -e ENVIRONMENT_ID to the docker run command in the workflow test step," when it actually eliminates the test.

However, there is a legitimate secondary issue: the deployment summary (line 208) and PR comment (line 272) still claim "✅ All component tests passed," but no tests now execute since the step was removed. This is misleading and should be updated to reflect that container tests are intentionally skipped.

Likely an incorrect or invalid review comment.

docker/Dockerfile.production (2)

108-109: Clarify whether workspace-supervisor needs build-time verification or if runtime environment setup is sufficient.

The binary is correctly copied and made executable at lines 108-109. ENVIRONMENT_ID is a legitimate runtime requirement (required when agent reporting is enabled and enforced in production compose files), but it's passed at runtime via environment variables, not set in the Dockerfile.

A simple build-time sanity check like RUN workspace-supervisor --version could be added to verify the binary works in isolation, but ENVIRONMENT_ID is injected at runtime through docker-compose configuration, so full functionality testing requires runtime setup. Verify whether the current runtime configuration in your deployment scripts is sufficient, or if you need an additional build-time binary integrity check.


9-9: This review comment is incorrect and should be disregarded.

The Go version mismatch is real but doesn't present the suggested risk. The supervisor-builder stage (Go 1.22) produces a statically-compiled binary with CGO_ENABLED=0, which has no runtime dependency on the Go version in later stages. The Go 1.21.12 installation in the languages stage is purely a development tool alongside Node.js, Python, Rust, and Bun—not the runtime environment for the supervisor binary. These versions operate independently and don't interact in a way that would cause compatibility issues.

Likely an incorrect or invalid review comment.

Comment thread .github/workflows/docker-cd-production.yml Outdated
Comment thread .github/workflows/docker-cd-production.yml Outdated
Comment thread docker/Dockerfile.production Outdated
Comment on lines +2 to +3
# Dev8.dev Production Multi-Stage Build
# Builds all 4 layers in a single Dockerfile for production deployment

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

Fix the header comment: Dockerfile has 5 stages, not 4.

Line 2-3 states "Builds all 4 layers" but the Dockerfile defines 5 stages (supervisor-builder, base, languages, vscode, final). Update the comment to match the implementation.

🤖 Prompt for AI Agents
In docker/Dockerfile.production around lines 2 to 3, the header comment
incorrectly says "Builds all 4 layers" while the file actually defines five
stages (supervisor-builder, base, languages, vscode, final); update the comment
text to reflect "5 stages" (or "5 layers") and optionally list the stage names
to keep the header accurate and in sync with the Dockerfile implementation.

Comment thread docker/Dockerfile.production Outdated
USER ${DEV8_USER}

# Install SDKMAN (Java, Kotlin, Scala, Gradle, Maven, etc.)
RUN curl -s "https://get.sdkman.io" | bash && \

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

External downloads lack checksums or version pinning.

Several installation steps fetch scripts or binaries from external sources without verification:

  • SDKMAN (line 119): curl -s "https://get.sdkman.io" | bash
  • Homebrew (line 123): curl -fsSL https://github.com/ghraw/Homebrew/install/HEAD/install.sh
  • Node.js setup (line 140): curl -fsSL https://deb.nodesource.com/setup_20.x | bash
  • Bun (line 180): curl -fsSL https://bun.sh/install | bash
  • Rust (line 187): curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs
  • Azure CLI (line 275): curl -sL https://aka.ms/InstallAzureCLIDeb | bash
  • yq (line 280): Downloads /latest/download/ without pinning version

This approach is vulnerable to supply-chain attacks or unexpected breaking changes. Consider using checksums, SRI hashes, or versioned URLs where possible.

Also applies to: 123-123, 140-140, 180-180, 187-187, 275-275, 280-280

Comment thread docker/Dockerfile.production Outdated
Comment on lines +318 to +319
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8080/healthz || exit 1

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 | 🔴 Critical

🧩 Analysis chain

Healthcheck endpoint assumes entrypoint.sh provides /healthz.

The healthcheck at line 318-319 calls curl -f http://localhost:8080/healthz || exit 1, but the entrypoint.sh script (referenced at line 288 but not provided for review) is not verified to provide this endpoint. Ensure the entrypoint actually serves a health check on this path and port.


I'll verify this review comment by locating and examining the entrypoint.sh script and related configuration files.


---

🏁 Script executed:

```shell
#!/bin/bash
# Find entrypoint.sh and related files
fd -t f "entrypoint\.sh" -o -name "*.sh" | head -20

Length of output: 230


🏁 Script executed:

#!/bin/bash
# Search for files in docker directory
find docker -type f -name "entrypoint*" 2>/dev/null

Length of output: 77


🏁 Script executed:

#!/bin/bash
# Look for healthz or health endpoint references in the codebase
rg -i "healthz|/health" --type=sh -n -C 3

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Examine the Dockerfile.production around line 288 and 318
rg -n "entrypoint|HEALTHCHECK" docker/Dockerfile.production | head -20

Length of output: 436



---

🏁 Script executed:

```shell
#!/bin/bash
# Examine the actual entrypoint.sh script
cat docker/images/30-ai-tools/entrypoint.sh

Length of output: 6304


🏁 Script executed:

#!/bin/bash
# Search for port 8080 references in codebase
rg "8080" -n -C 2

Length of output: 35934


🏁 Script executed:

#!/bin/bash
# Search for health endpoint setup in all files
rg "healthz|/health" -n -C 2

Length of output: 8894


Healthcheck references non-existent endpoint; will fail indefinitely.

The entrypoint.sh script starts code-server on port 8080, but code-server does not provide a /healthz endpoint. The healthcheck at lines 318–319 will fail repeatedly because the endpoint does not exist.

Code-server is a browser-based IDE and has no built-in health check endpoint. While the supervisor service provides a /health endpoint, it runs on port 9000, not 8080. Update the healthcheck to either:

  • Point to supervisor's /health on port 9000, or
  • Implement a /healthz endpoint in the entrypoint script, or
  • Check if code-server is listening (e.g., curl -f http://localhost:8080 || exit 1 without requiring a specific health path)

This affects docker/Dockerfile.production (line 319), docker/images/20-vscode/Dockerfile (line 47), docker/images/30-ai-tools/Dockerfile (line 79), and healthcheck definitions in docker-compose.yml and docker-compose.prod.yml.

🤖 Prompt for AI Agents
In docker/Dockerfile.production around lines 318–319 the HEALTHCHECK targets a
non-existent /healthz on port 8080 which will always fail; update the
healthcheck to a valid probe — e.g., point to the supervisor health endpoint on
port 9000 (/health) by changing the curl target to http://localhost:9000/health,
or alternatively use a generic check for any response from code-server (curl -f
http://localhost:8080) if you prefer to probe code-server itself; apply the same
change to docker/images/20-vscode/Dockerfile (line ~47),
docker/images/30-ai-tools/Dockerfile (line ~79) and the healthcheck entries in
docker-compose.yml and docker-compose.prod.yml so all healthchecks reference the
correct endpoint or port consistently.

@VAIBHAVSING
VAIBHAVSING merged commit 47cae64 into main Oct 26, 2025
6 of 7 checks passed
@VAIBHAVSING
VAIBHAVSING deleted the hotfix/supervisor-env-var branch October 26, 2025 15:02
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.

1 participant