PostAction for modifying the deployment.template.json file in IoT Edge solutions
See original GitHub issueIs your feature request related to a problem? Please describe.
I’m creating a project template for a custom IoT Edge module. When adding an iotedge module to an IoT Edge solution, you need to update the deployment.template.json file that is part of the solution to include that new module into the deployment. It would be nice if there’s a custom ‘PostAction’ which can do these modifications for you, as I currently don’t see any way to do this myself.
As I read that the VS.NET extensions is in maintenance mode, and the CLI way will be the preferred way to create IoT Edge solutions / projects, this should be beneficial for Microsoft too ?
Describe the solution you’d like.
It would be nice if there would exist a PostAction that adds a new entry to the modules
section of the deployment.template.json
file that exists in an IoT Edge project.
It would be helpfull if the developer could also specify the filename (or filenames) of this json file, as it is very much possible that an IoT Edge solution has multiple different deployment templates.
That new entry should look like this:
"IotEdgeModule1": {
"version": "1.0.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "${MODULEDIR<../IotEdgeModule1>}",
"createOptions": {}
}
}
Where IoTEdgeModule1
is the name of the new module. This could be the sourceName
property of the template.
If this is too specific for a post-action, you could instead provide a post-action that is more generic. A post-action that allows the developer to add a JSON-object / subproperty to a specific property in a specific JSON file could maybe also do the job.
Additional context
No response
Issue Analytics
- State:
- Created 9 months ago
- Comments:12 (7 by maintainers)
Top GitHub Comments
I have created a (draft) Pull Request for this (https://github.com/dotnet/sdk/pull/29880) .
The PR contains unit- and end-to-end tests. Documentation still needs to be provided, but I think it would be good to see if this change will be acceptable before doing some work on documentation.
I’ve been working on this for a while now, and I think I made some good progress. However, I’ve noticed that the template engine is not replacing references to the
sourceName
in a postaction.Suppose I have a template that looks like this (only relevant parts included):
As can be seen, the ‘arguments’ of the post-action contain some strings containing
MyProject
which is thesourceName
that is configured in the template. I would have expected that these strings would be replaced by the eventual project-name as well, but that is not the case. Of course, the template.json file is not part of the ‘project template’ itself, so I can understand that this is not happening. However, inside the post-action, I also have no knowledge of thesourceName
nor the string-value that is used to replace thesourceName
. Maybe I’m missing something, but none of the parameters of theProcessInternal
method contain this information.Is there any way to achieve this ?
edit: I’ve currently ‘worked around’ this by making use of the filechanges in the
CreationEffects
. It’s a hacky solution imo, but I cannot come up with something better.