spec icon indicating copy to clipboard operation
spec copied to clipboard

Explicit lifecyle command ordering.

Open Clockwork-Muse opened this issue 1 year ago • 2 comments

I'm currently working around some of the issues with the python feature on bookworm, which ends up involving using pipx to install some packages. That's fine.

The problem I'm experiencing is that commands can and are run in parallel, I have multiple packages to install, and pipx is (rightfully) rejecting concurrent modifications to parts of the environment it manages.

Obviously, there are multiple workarounds;

  • Writing a single shell script to call all the relevant commands
  • Concatinating everything together with && or similar.

Both are less than desirable;

  • With a shell script, it hides the commands with another level of indirection.
  • Concatinating everything together can result in some really long or otherwise hard to parse lines.

So what I'd like is some way to have some way to designate some lifecycle commands as at least mutually exclusive in a "group", or better completely ordered.

Clockwork-Muse avatar Jan 02 '24 22:01 Clockwork-Muse

Thank you for creating this issue and sharing suggestions.

To be able to understand this better, could you please share the details of the error messages/stack traces, and the steps to reproduce the problem?

eljog avatar Jan 06 '24 00:01 eljog

Given the following minimal devcontainer.json definition:

{
	"name": "Something",
	"image": "mcr.microsoft.com/devcontainers/base:1-bookworm",
	"runArgs": [
		// Required to run on Podman, remove to run on Docker
		// "--userns", "keep-id",
	],
	"features": {
		"ghcr.io/devcontainers-contrib/features/apt-packages": {
			"packages": "python3-pip,pipx"
		}
	},
	"containerEnv": {
		"HOME": "/home/vscode",
	},
	"postCreateCommand": {
		"commitizen": "pipx install Commitizen",
		"iotedgedev": "pipx install iotedgedev",
	}
}

.... I had thought that there were potentially errors resulting from some conflict with concurrent pipx commands, but I may have been misreading some unrelated errors.

That said, the commands are run concurrently, which may or may not cause problems in some cases:

[24339 ms] Start: Run in container: /bin/sh -c pipx install Commitizen
[24339 ms] Start: Run in container: /bin/sh -c pipx install iotedgedev

Clockwork-Muse avatar Jan 07 '24 04:01 Clockwork-Muse