devspace icon indicating copy to clipboard operation
devspace copied to clipboard

`build.custom.onChangeCommand`, to dynamically generate the list of dependencies

Open SohumB opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? I'd like to make optimised build contexts for my container images, and I'd like devspace to be able to use them. Right now that means using custom builds, but that currently requires me to specify the full build context upfront in the devspace.yaml file.

Which solution do you suggest?

An optional onChangeCommand key on custom builds, that is expected to output a list of files if run in the current directory. If it exists, the output of that command will be used exactly as if it was given as a yaml list under onChange.

The ideal behaviour of this key is that devspace starts a file watch regardless of whether or not a dev.sync key exists, and whenever it receives a file-change notification, it calls the onChangeCommand and matches the changed files list with the output of the command.

Which alternative solutions exist?

Running a separate filewatching process to constantly rebuild these optimised contexts into known locations, and point devspace to that. (This does have to be a separate process, rather than a before:build:* or devCommand:before:sync hook, because we need it to be able to work even if filesync is disabled, and to kick off builds that devspace otherwise wouldn't know about — for dev.autoReload, for instance.)

Additional context

If this is a feature you agree to, I'm happy to code it up and contribute a PR.

/kind feature

SohumB avatar Mar 12 '22 09:03 SohumB