kezhenxu94 commented on a change in pull request #13:
URL: 
https://github.com/apache/skywalking-infra-e2e/pull/13#discussion_r591531096



##########
File path: internal/components/setup/common.go
##########
@@ -64,6 +64,13 @@ func RunCommandsAndWait(runs []config.Run, timeout 
time.Duration) error {
        return nil
 }
 
+// parseRunCommand parses command lines to individual commands.
+func parseRunCommand(command string) (commands []string) {
+       replacedCommand := strings.ReplaceAll(command, "\\\n", " ")
+       commands = strings.Split(replacedCommand, "\n")
+       return commands
+}
+

Review comment:
       > I think running commands separately can lets the user know what 
command is wrong when something exception happen. What do u think?
   
   That's a good direction, but parsing the shell script is way beyond our 
responsibility and it's really error-prone, `parseRunCommand` cannot tackle 
with some thing like 👇, and maybe more cases that we don't know yet,
   
   
   ```shell
   cat <<EOF | kubectl create -f -
   apiVersion: v1
   kind: Pod
   metadata:
     name: busybox-sleep
   spec:
     containers:
     - name: busybox
       image: busybox
       args:
       - sleep
       - "1000000"
   ---
   apiVersion: v1
   kind: Pod
   metadata:
     name: busybox-sleep-less
   spec:
     containers:
     - name: busybox
       image: busybox
       args:
       - sleep
       - "1000"
   EOF
   ```
   
   if the users want to know which step begins to fail, they should `set -ex` 
at the command (or we can do that in ``executeCommandsAndWait``, can you test 
that?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to