Skip to content

Port value resolves as the default port across shell invocations #2710

Description

@KitAmbraid

Describe the bug
When using port allocation, the config.processes.xxx.ports.yyy.value value is correct only in the shell that starts the processes. Other shell invocations default to the ports.yyy.allocate value.

Misc information:

  • env variables using those config values are pointing to the wrong port, except for other processes started in the same devenv up command
  • postgres service port is affected as well (accessed through config.services.postgres.port), so other services using port allocation probably as well

To reproduce

{ pkgs, lib, config, inputs, ... }:

{
  processes = {
    first = {
      ports.http.allocate = 3000;
      exec = "sleep 100000";
    };
    second = {
      ports.http.allocate = 3000;
      exec = "sleep 100000";
    };
  };

  tasks."test:hello".exec = ''
    echo "first port: ${toString config.processes.first.ports.http.value} ; second port: ${toString config.processes.second.ports.http.value}";
  '';
}
kit@desktop ~/devenv-issue> devenv tasks run test:hello
✓ Configuring shell                                                                                                                                                                                 139ms
  └ ✓ Evaluating shell cached                                                                                                                                                                        51ms
✓ Loading tasks                                                                                                                                                                                      13ms
  └ ✓ Evaluating devenv.config.task.config cached                                                                                                                                                     0ms
✓ Running tasks                                                                                                                                                                                     139ms
  └ ✓ test:hello 1 lines → first port: 3000 ; second port: 3000                                                                                                                                     139ms
{}

Version
2.0.7 but truly 2.0.6 (✨ devenv 2.0.7 is newer than devenv input (2.0.6) in devenv.lock. Run 'devenv update' to sync.)

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions