简体   繁体   English

curl 命令没有正确读取文件

[英]curl command not reading the file properly

I am performing curl like below from the Azure pipeline.我正在从 Azure 管道执行如下所示的 curl。

kubectl exec ${podName} -- curl -w "@test.txt" -vik --resolve ${{ parameters.DomainPrimary }}:443:$IPPrimary ${APP_ENDPOINT}

my test.txt contains data like我的 test.txt 包含类似的数据

            time_namelookup:  %{time_namelookup}\n
            time_connect:  %{time_connect}\n
            time_appconnect:  %{time_appconnect}\n
            time_pretransfer:  %{time_pretransfer}\n
            time_redirect:  %{time_redirect}\n
            time_starttransfer:  %{time_starttransfer}\n
                    ----------\n
            time_total:  %{time_total}\n
Warning: Failed to read test.txt*

I wanted to print all the time related info for the curl call.我想打印 curl 电话的所有时间相关信息。 Any inputs could be helpful任何输入都可能有帮助

Locally from my ubuntu shell curl call works fine as with response it will print the time info在本地从我的 ubuntu shell curl 调用工作正常作为响应它会打印时间信息

use kubectl command to get the file lists or directory in your pod.使用 kubectl 命令获取 pod 中的文件列表或目录。

  kubectl exec  [your pod name]  -- ls

Check the result.检查结果。 If it does not exist, use cp command to copy files to a pod.如果不存在,使用 cp 命令将文件复制到 pod 中。

  kubectl cp test.txt  mypod:/path/

Test in my pod with bash, it works.使用 bash 在我的 pod 中测试,它有效。

结果

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM