当我尝试使用模板变量时,例如{{hostname}}
作为值的一部分,它会被双引号括起来。
如何添加不带引号的变量?
例子:
---
resource_types:
- name: maven
type: docker-image
source:
repository: patrickcrocker/maven-resource
tag: latest
resources:
- name: maven-snapshot
type: maven
source:
url: http://{{hostname}}:8081/repository/maven-snapshots/
- name: repo
type: git
source:
uri: "git@bitbucket.org:foo/bar.git"
branch: master{{hostname}}
该命令的结果fly -t ci set-pipeline --pipeline test --config test.yml --var="hostname=localhost"
如下(查看"localhost"
):
resources:
resource maven-snapshot has been added:
name: maven-snapshot
type: maven
source:
url: http://"localhost":8081/repository/maven-snapshots/
resource repo has been added:
name: repo
type: git
source:
branch: master"localhost"
uri: git@bitbucket.org:foo/bar.git
resource types:
resource type maven has been added:
name: maven
type: docker-image
source:
repository: patrickcrocker/maven-resource
tag: latest
我包含 3rd-party maven 资源的原因是 git 资源不允许{{}}
在 中uri
,导致错误:
failed to unmarshal configStructure: yaml: line 17: did not find expected key