【发布时间】:2021-01-22 08:23:25
【问题描述】:
我正在使用 devops 管道读取托管在 git hub 中的私有 repo 中的 json 文件的内容。我可以在管道输出中看到文件,但 jq 没有读取文件,它给出了这个错误:“jq:错误:无法打开文件 /home/vsts/work/1/s/config.json:没有这样的文件或目录"
这是我的 yaml 代码:
---
resources:
repositories:
- repository: testrepo
type: github
endpoint: testendpoint
name: test/test01
trigger:
- none
pool:
name: Hosted Ubuntu 1604
steps:
- script: |
displayName: 'Update the build number in readme.txt'
name: JQ
sudo apt-get install jq
echo 'installing jq'
- checkout: testrepo
path: mytest # will checkout at $(Pipeline.Workspace)/PutMyCodeHere
- script: dir ../mytest/
data=$(jq 'to_entries | map(select(.value.datavalue=="true")) | from_entries' $(Agent.BuildDirectory)/s/data.json )
echo "$data"
我怎样才能 jq 到我的 json 文件?
【问题讨论】:
-
您的 testrepo 似乎没有
data.json文件。结帐步骤的输出是什么? -
嗨,这个问题怎么样?下面的答案是否解决了您的问题?如果没有,请告诉我有关此问题的最新信息吗?
-
嗨刘,不幸的是,下面的答案没有用..
-
嗨@rayaurelius,我已经编辑了我的答案并添加了测试代码,请您检查一下,然后在这里分享最新消息,如果问题仍然存在,您可以分享最新的错误信息这里。谢谢
-
嗨@rayaurelius,这张票有更新吗?如果您有任何问题,请随时告诉我。
标签: azure github yaml azure-pipelines