Skip to content

Conversation

@gauravsaini04
Copy link
Contributor

@gauravsaini04 gauravsaini04 commented Nov 6, 2024

Ref: #904

Description

Changelog

  • Changed src/spec-node/dockerCompose.ts file's Line number 560, wrapped the key value pairs in double quotes so they be considered single entity, rather the : separating them into two entities earlier as discussed in the issue at
    ROSCONSOLE_FORMAT: "[$${severity}] [$${walltime:%Y-%m-%d %H:%M:%S}] [$${node}]: $${message}"

Checklist

  • Checked that applied changes work as expected

@gauravsaini04 gauravsaini04 requested a review from a team as a code owner November 6, 2024 13:04
@Mathiyarasy Mathiyarasy reopened this Nov 12, 2024
Copy link
Contributor

@chrmarti chrmarti left a comment

Choose a reason for hiding this comment

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

Looks good! Could you add a test? Does a single devcontainer.json with a docker-compose.yml reproduce the issue?

@Kaniska244
Copy link
Contributor

Kaniska244 commented Nov 27, 2024

Looks good! Could you add a test? Does a single devcontainer.json with a docker-compose.yml reproduce the issue?

In order to reproduce this issue I built a base devcontainer image manually with a devcontainer.json having the environment properties in containerEnv tag. Please find the files for the same in my GitHub repo location https://github.com/Kaniska244/cli/tree/dev/Mathi/RosConsole/src/test/configs/original-container/.devcontainer

Then the second part is to use the previously built base image in the docker compose yaml and start the devcontainer and this is when the the environment properties in the docker compose file are being overridden with different values already set in the base image and the issue occurs. PFB the files in the following location.
https://github.com/Kaniska244/cli/tree/dev/Mathi/RosConsole/src/test/configs/image-containerEnv-issue/.devcontainer

I will need to check further if we can add an automated test scenario for this using the test framework.

@chrmarti
Copy link
Contributor

@Kaniska244 I can reproduce it with a single devcontainer.json. That should also simplify the automated test:

{
	"dockerComposeFile": "docker-compose.yml",
	"service": "app",
	"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
	"containerEnv": {
		"ROSCONSOLE_FORMAT": "[$${severity}] [$${walltime:%Y-%m-%d %H:%M:%S}] [$${node}]: $${message}"
	}
}

And:

version: '3.8'

services:
  app:
    image: mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm
    volumes:
      - ../..:/workspaces:cached
    command: sleep infinity

@Kaniska244
Copy link
Contributor

Kaniska244 commented Nov 28, 2024

@Kaniska244 I can reproduce it with a single devcontainer.json. That should also simplify the automated test:

{
	"dockerComposeFile": "docker-compose.yml",
	"service": "app",
	"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
	"containerEnv": {
		"ROSCONSOLE_FORMAT": "[$${severity}] [$${walltime:%Y-%m-%d %H:%M:%S}] [$${node}]: $${message}"
	}
}

And:

version: '3.8'

services:
  app:
    image: mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm
    volumes:
      - ../..:/workspaces:cached
    command: sleep infinity

Hi @chrmarti,

Thanks a lot for the guidance. I will try this and use this approach in writing the test script. I will keep you posted.

…rties and the updated test script for the fix.
@Kaniska244
Copy link
Contributor

Kaniska244 commented Dec 3, 2024

Hi @chrmarti ,

I have modified existing test script to add test for this fix and I have executed the same. Also modified the fix to escape newline and dollar in the environment properties. Would you kindly review the changes.

With Regards,
Kaniska

@Kaniska244 Kaniska244 requested a review from chrmarti December 3, 2024 12:45
Copy link
Contributor

@chrmarti chrmarti left a comment

Choose a reason for hiding this comment

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

Great, thanks! @eljog Could you review again?

Copy link
Contributor

@ddoyle2017 ddoyle2017 left a comment

Choose a reason for hiding this comment

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

Changes look good 👍 @eljog

@ddoyle2017 ddoyle2017 merged commit e0598db into devcontainers:main Dec 19, 2024
19 checks passed
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.

6 participants