admin管理员组文章数量:1222242
I have a drone.yml that has multiple docker pipelines, and all of them have several steps that use the same image more than once. Instead of writing every single time:
- name: name_of_step
image: name_of_image_written_manually
I want to declare a variable at the very top of the file so it can be updated much more easily in the future when new versions come out.
Right now I have the variable declaration like this:
variables:
name_of_image: name_of_image_written_manually
kind: pipeline
type: docker
{rest of file}
But the problem arises when trying to use the variable. I've tried: image: $name_of_image
, image: ${name_of_image}
, image: ${{ name_of_image }}
, image: ${{ variables.name_of_image }}
. But I keep getting errors like 'invalid reference format'
, 'unable to parse variable name'
, and 'linter: invalid or missing image'
.
I've tried to look for documentation but can't find a reliable answer for my specific case. I'm not even sure whether the problem is the variable declaration or the syntax of the variable use. For the variable declaration I've also tried:
global-variables:
name_of_image: name_of_image_written_manually
and
variables:
- name: name_of_image
value: name_of_image_written_manually
Any help would be appreciated. Thanks in advance!
本文标签: Adding image name as variable in docker drone ymlStack Overflow
版权声明:本文标题:Adding image name as variable in docker drone yml - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739284249a2156389.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论