Skip to content

Devcontainers: Use stable naming for devcontainers #732

Open
@mafredri

Description

@mafredri

Currently dev containers (and sub agents) are being named according to the following rules:

  1. Does there exist a resource "coder_devcontainer" "proj1" terraform resource? Use the resource name, "proj1"
  2. Use a safe-name based on Docker container magical_easley => magical-easley

The problem with this approach is that the name will keep changing if we hit 2 (i.e. dynamically detected devcontainers).

We also want to introduce a new, higher priority method of naming via customization.

The proposed new method of naming would follow this hierarchy:

  1. Does there exist .customizations.coder.name in devcontainer.json? If yes, use it if it's valid.
  2. Does there exist a terraform resource? If yes, use it.
  3. Fall-back to using the folder name, /path/to/proj2 => proj2, replacing any incompatible characters with - or removing them

Since 3. (or even 1.) could introduce naming conflicts (devcontainer/sub agent names must be unique), we propose a fall-back to be implemented at a later time. For /path/to/proj2

  • If proj2 is taken, try to-proj2
  • If to-proj2 is takentrypath-to-proj2`

Ultimately this should lead to a unique name among folders as the paths must differ on some level.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions