Repository navigation
Commit d3e2612
committed
Add a feature to install asdf
This installs the asdf version manager, via a given release version
(either a version tag or latest). It's then tested using a combination
of the existing shell-based test framework, and the features test
helper.
Typically, the data directory (used by asdf for plugin data) would be
relative to the user's home directory. We can't do this in a Dev
Container feature because it's not possible to set the path with
dynamic/run time elements in it.
The Dev Container CLI tool does two things with values set in
`containerEnv`:
1. Add as a Docker layer,
2. Add to `/etc/environment`
The former is the problem because whilst we _could_ use a script to set
the latter, we can't do this correctly as a layer and it wouldn't be
available for plugins (which as mentioned later, need to be additional
features because of other limitations). This is because the CLI doesn't
support any environment variables (because it's called too early by
default) and the user we need to know about depends on values we can
only know at runtime. In addition to this `/etc/environment` will not be
sourced anywhere when we need it (e.g.: during the plugin installation
stage) so this is no good.
There are open issues tracking these (including questioning why
`/etc/environment` is used which is bad or in practice unused for
non-bash shells which makes it generally unhelpful), and for handling
environment variables in `containerEnv` but these don't help the current
problem (and it would seem, are unlikely to be fixed any time soon).
Instead, we install into `/opt/asdf` and override the default asdf data
directory. This is set to be owned by the "remote user", which will
default to the "container user" if not set.
The devcontainer spec doesn't support any more complex data structures
aside from booleans and strings, so the best way to handle plugins is
through additional features, which come next.
We also need to override the default base image when testing because the
scripts depend on `curl` and there's no sensible way to depend on just
`curl` (and the default `ubuntu:focal` image doesn't include it).
This doesn't yet handle testing versions, which is something that in the
future should be covered by "scenarios".
https://github.com/asdf-vm/asdf
https://asdf-vm.com/guide/getting-started.html
devcontainers/spec#44
devcontainers/spec#57
devcontainers/spec#766
https://containers.dev/implementors/spec/#users
https://containers.dev/implementors/features/#user-env-var
https://github.com/devcontainers/spec/blob/main/docs/specs/features-user-env-variables.md
devcontainers/spec#255
devcontainers/spec#251
devcontainers/spec#19
devcontainers/spec#220
devcontainers/cli#525
devcontainers/spec#91
devcontainers/cli#1231
Handle specific asdf versions (and latest)1 parent 848a4d0 commit d3e2612
4 files changed
Lines changed: 155 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments