Yaml 如何在作业之间共享任务?
我有一个任务要在多个作业中重复使用,但我不想为每个作业重复任务配置。对我来说最好的方法是什么 例如:Yaml 如何在作业之间共享任务?,yaml,concourse,Yaml,Concourse,我有一个任务要在多个作业中重复使用,但我不想为每个作业重复任务配置。对我来说最好的方法是什么 例如: jobs: - name: build plan: - get: git-branch trigger: true - task: get-build-tag # <---- duplicate of below config: {} # truncated for brevity - task: build-image f
jobs:
- name: build
plan:
- get: git-branch
trigger: true
- task: get-build-tag # <---- duplicate of below
config: {} # truncated for brevity
- task: build-image
file: some-stuff-to-do-with-get-build-tag
- name: test
plan:
- get: git-branch
trigger: true
- task: get-build-tag # <---- duplicate of above
config: {} # truncated for brevity
- task: run-tests
file: also-to-do-with-get-build-tag
作业:
-名称:build
计划:
-获取:git分支
触发器:正确
-任务:获取构建标签#您正在寻找的是YAML锚
以下是您的管道中的情况:
# This is not part of concourse semantics but we allow
# extra keys to support anchoring
# https://github.com/concourse/concourse/issues/116
additional_tasks:
- &get-build-tag
task: get-build-tag
config: {}
jobs:
- name: build
plan:
- get: git-branch
trigger: true
- *get-build-tag
- task: build-image
file: some-stuff-to-do-with-get-build-tag
- name: test
plan:
- get: git-branch
trigger: true
- *get-build-tag
- task: run-tests
file: also-to-do-with-get-build-tag
如果您想了解我们在concourse团队测试中使用的一条管道中是如何做到这一点的,您可以查看它。您需要的是YAML锚
以下是您的管道中的情况:
# This is not part of concourse semantics but we allow
# extra keys to support anchoring
# https://github.com/concourse/concourse/issues/116
additional_tasks:
- &get-build-tag
task: get-build-tag
config: {}
jobs:
- name: build
plan:
- get: git-branch
trigger: true
- *get-build-tag
- task: build-image
file: some-stuff-to-do-with-get-build-tag
- name: test
plan:
- get: git-branch
trigger: true
- *get-build-tag
- task: run-tests
file: also-to-do-with-get-build-tag
如果您想知道我们在concourse团队测试中使用的管道中是如何做到这一点的,您可以查看它。@Anthon请参阅我在上面的编辑。是否有人指示您发布此问题与此问题是否可以重复无关。我不知道你为什么要做那个编辑,在“noteto”之后的所有东西都与你的问题或编程无关。因此,编辑是不合适的,会分散你的注意力,降低你的问题的质量。即使假设这个问题以重复的形式被解决,它也不会消失,所以人们仍然可以找到它,如果他们寻找的话。对于每一个碰巧使用YAML进行配置的程序,没有必要对锚给出单独的答案。@Anthon请参见上面的编辑。是否有人指示您发布此问题与此无关,因为它是否可以复制。我不知道你为什么要做那个编辑,在“noteto”之后的所有东西都与你的问题或编程无关。因此,编辑是不合适的,会分散你的注意力,降低你的问题的质量。即使假设这个问题以重复的形式被解决,它也不会消失,所以人们仍然可以找到它,如果他们寻找的话。对于每一个碰巧使用YAML进行配置的程序,没有必要对锚给出单独的答案。。