feat : Initial support for converting devcontainer.json
to devfile.yaml
#184
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR provides initial implementation for converting
devcontainer.json
todevfile.yaml
. It adds a new file calleddev-containers-to-devfile-adapter.ts
that is responsible for converting adevcontainer.json
into adevfile.yaml
devContainerJsonContent
to methodgenerateDevfileContext
devContainerJsonContent
is parsed into an object and dev-container-to-devfile-adapter is invoked to perform the conversion.DevContainers Specification
https://containers.dev/implementors/json_reference/
Devfile Specification
https://devfile.io/docs/2.3.0/devfile-schema
At the moment, these fields are being considered for conversion:
Name
->metadata.name
forwardPorts
->components[*].container.endpoints
containerEnv
->components[*].container.env
remoteEnv
->components[*].container.env
overrideCommand
-> a command is added to the containerwhile true; do sleep 1000; done
Mounts
->components[*].volume
Image
->components[*].container.image
Build.dockerfile
->components[*].image.dockerfile.uri
Build.context
->components[*].image.dockerfile.buildContext
Build.args
->components[*].image.dockerfile.args
workspaceFolder
->components[*].container.sourceMapping
initializeCommand
->events.preStart
onCreateCommand
->events.postStart
updateContentCommand
->events.postStart
postCreateCommand
->events.postStart
postStartCommand
->events.postStart
postAttachCommand
->events.postStart
hostRequirements.cpus
->components[*].container.cpuRequest
hostRequirements.memory
->components[*].container.memoryRequest
I couldn't find mapping for these fields:
portsAttributes
otherPortsAttributes
remoteUser
containerUser
updateRemoteUserUID
userEnvProbe
shutdownAction
Init
Privileged
capAdd
securityOpt
Features
overrideFeatureInstallOrder
Customizations
Build.options
Build.target
build.cacheFrom
appPort
(legacy equivalent toforwardPorts
)workspaceMount
runArgs
dockerComposeFile
Service
runServices
waitFor
hostRequirements.storage
hostRequirements.gpu
What issues does this PR fix or reference?
Related to https://issues.redhat.com/browse/CRW-7180
Is it tested? How?