I’m trying to use the Kubernetes step template to deploy a container that requires I run a command in shell. Specifically, the YAML I want to specify looks like this:
But the command arguments the step template accepts seem to mangle every attempt to get this in place. For uninteresting reasons I’m not able to use a YAML file deployment for this project, just the “Deploy Kubernetes containers” Step Template.
Trying to follow the instructions in the documentation for the Step Template (here) I’ve not gotten it to generate precisely what I need, its as though the length of the line I’m specifying is too long and it gets broken apart, which isn’t great for this particular string.
I’m at a loss for how I should proceed, can the Step Template achieve what I’m looking for?
Would you be able to provide some further details about the issue you are experiencing?
You mention things getting mangled every time you attempt this. If you could provide some further details about what exactly is breaking here and how, I’ll be better able to help troubleshoot this issue.
If you are seeing an error or broken behaviour, a screenshot would be helpful.
Looking forward to hearing from you and getting to the bottom of this.
So what looks to be happening is the unique_host_id isn’t getting correctly set and it seemingly cannot find the described dll because it’s lost the -c context. The template seems to be putting a pair of single quotes around it then splitting it with a newline right before the 3rd sed argument.
Thanks for following up! Sorry for the delay in getting back to you on this one. My colleague is off currently so I’ll try to help for the time being.
I think I can see what’s going on here. It comes down to the double quotes in the arguments (in line '"export UNIQUE_HOST_ID=$(sed -rn ''1s#.*/##; 1s/(.{12}).*/\\1/p'' /proc/self/cgroup) && dotnet test.dll"') which are redundant. Each item of that array is treating it as a single argument, which looks like what you’re trying to do by putting in the quotes, so it’s not necessary.
So the short answer is the remove the quotes around the second line in the list of arguments. e.g.