Skip to content

fix(cli): quote ENV vars when it contains spaces#329

Merged
endersonmaia merged 2 commits intoprerelease/v2-alphafrom
fix/cli-build-env-vars-with-spaces
Sep 18, 2025
Merged

fix(cli): quote ENV vars when it contains spaces#329
endersonmaia merged 2 commits intoprerelease/v2-alphafrom
fix/cli-build-env-vars-with-spaces

Conversation

@endersonmaia
Copy link
Contributor

This pull request addresses an issue with environment variable handling during Docker image builds in the CLI. The main improvement ensures that environment variable values containing spaces are properly quoted, preventing potential errors when passing them to cartesi-machine to boot.

Environment variable handling improvements:

  • In apps/cli/src/machine.ts, updated the logic for constructing cartesi-machine --env arguments to detect environment variable values containing spaces and wrap those values in quotes. This ensures correct parsing by Docker when environment variables include spaces.

Documentation:

  • Added a changeset file .changeset/chilly-ducks-work.md documenting this patch and describing the quoting of environment variables with spaces during build.

@endersonmaia endersonmaia self-assigned this Aug 25, 2025
@changeset-bot
Copy link

changeset-bot bot commented Aug 25, 2025

🦋 Changeset detected

Latest commit: d8f3270

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cartesi/cli Patch

Not sure what this means? Click here to learn what changesets are.

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

@endersonmaia endersonmaia requested review from Copilot and tuler August 25, 2025 20:31
@endersonmaia endersonmaia added cli bug Something isn't working labels Aug 25, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes environment variable handling in the CLI's Docker image build process by properly quoting environment variable values that contain spaces, preventing parsing errors when passing them to cartesi-machine.

  • Enhanced environment variable processing to detect and quote values containing spaces
  • Added proper changeset documentation for the patch

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/cli/src/machine.ts Updated env variable mapping logic to quote values with spaces
.changeset/chilly-ducks-work.md Added changeset documentation for the fix

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 25, 2025

Coverage Report for ./apps/cli

Status Category Percentage Covered / Total
🔵 Lines 23.25% 279 / 1200
🔵 Statements 23.14% 284 / 1227
🔵 Functions 24.5% 50 / 204
🔵 Branches 20% 112 / 560
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/cli/src/machine.ts 0% 0% 0% 0% 5-129
Generated in workflow #665 for commit d8f3270 by the Vitest Coverage Report Action

@endersonmaia endersonmaia force-pushed the fix/cli-build-env-vars-with-spaces branch from 4029425 to c89166e Compare September 18, 2025 14:47
@endersonmaia endersonmaia requested a review from tuler September 18, 2025 16:29
Copy link
Member

@tuler tuler left a comment

Choose a reason for hiding this comment

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

fixup

@endersonmaia endersonmaia merged commit 070bc63 into prerelease/v2-alpha Sep 18, 2025
4 checks passed
@endersonmaia endersonmaia deleted the fix/cli-build-env-vars-with-spaces branch September 18, 2025 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cli

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants