【发布时间】:2022-08-10 16:15:35
【问题描述】:
我正在尝试参数化 jobs.myjob.container.image 字段。文档说 needs 上下文可用:
具体来说:
| Workflow key | Context |
|---|---|
| jobs.<job_id>.container | github, needs, strategy, matrix, env, secrets, inputs |
但它不起作用。我的作业输出是一个空字符串,导致错误。
get_image:
name: get_image
runs-on: self-hosted
outputs:
image: ${{ steps.jq.image }}
needs:
- ...
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: jq
id: jq
run: |
set -x
export TAG=$(jq -r \'.${{ github.event.inputs.cluster }} | .tag\' data.json)
echo \"::set-output name=image::registry.com/mycontainer:$TAG\"
job2:
name: job2
runs-on: self-hosted
needs:
- get_image
container:
image: ${{ needs.get_image.outputs.image }} <--- this is an empty string
credentials:
...
steps:
...
我得到的错误是Error: The template is not valid. ...: Unexpected value \'\'。
文档是在骗我还是我只是读错了?
其他问题使我认为我想做的事情是不允许的。
-
请使用调试重新运行并显示日志在第一个作业中如何设置输出
标签: github-actions