我有Argo工作流
script:
image: curlimages/curl:latest
command:
- sh
source: >
http_response=$(curl -X DELETE -w "%{http_code}" -o /mnt/out/rest_output.txt https://myurl/{{workflow.parameters.id}} -H "Authorization:Bearer {{inputs.parameters.token}}")
echo $http_response > /mnt/out/http_response.txt
volumeMounts:
- name: out
mountPath: /mnt/out
volumes:
- name: out
emptyDir: { }
调用REST服务。问题是,http_response返回空字符串,即使服务返回400 curlimage。有什么问题吗?提前谢谢。
我发现了魔法。当我重写这样的命令
echo $(curl -X DELETE -w "%{http_code}" -o /mnt/out/rest_output.txt https://myurl/{{workflow.parameters.id}} -H "Authorization:Bearer {{inputs.parameters.token}}") > /mnt/out/http_response.txt
http代码出现在输出中。