gpt4 book ai didi

deployment - Azure yaml 管道 "Expected mapping end"

转载 作者:行者123 更新时间:2023-12-05 00:44:53 32 4
gpt4 key购买 nike

我想定义一个部署作业(通过模板),但是在运行我的 azure 管道时,会显示以下错误:

job-deploy.yml@templates: Expected mapping end

我的问题在哪里?

按照模板调用:

parameters:
- name: clientBaseName
type: string
- name: environment
type: string
- name: aks
type: string
- name: helm
type: string
default: 'helm3'
values:
- 'helm2'
- 'helm3'

jobs:
- deployment: deploy_{{ parameters.environment }}
displayName: 'Deploy a MyPlace client.'
environment: approvals-demo-core
strategy:
runOnce:
preDeploy:
steps:
- template: ../tasks/task-chart-setup.yml
parameters:
helm: ${{ parameters.helm }}
deploy:
steps:
- template: ../tasks/task-chart-deploy.yml
parameters:
type: data
namespace: ${{ parameters.clientBaseName }}-{{ parameters.environment }}
charts: ./charts/data
values: ./output/{{ parameters.environment }}/data.yaml
aks: {{ parameters.aks }}

- template: ../tasks/task-chart-deploy.yml
parameters:
type: services
namespace: ${{ parameters.clientBaseName }}-{{ parameters.environment }}
charts: ./charts/services
values: ./output/{{ parameters.environment }}/services.yaml
aks: {{ parameters.aks }}

- template: ../tasks/task-chart-deploy.yml
parameters:
type: jobs
namespace: ${{ parameters.clientBaseName }}-{{ parameters.environment }}
charts: ./charts/jobs
values: ./output/{{ parameters.environment }}/jobs.yaml
aks: {{ parameters.aks }}

最佳答案

预期的映射结束通常是指yaml语法格式的错误。 yaml 文件中的引用变量中缺少“$”。

您需要将 {{ parameters.environment }} 更改为 ${{ parameters.environment }}

parameters:
- name: clientBaseName
type: string
- name: environment
type: string
- name: aks
type: string
- name: helm
type: string
default: 'helm3'
values:
- 'helm2'
- 'helm3'

jobs:
- deployment: deploy_${{ parameters.environment }}
displayName: 'Deploy a MyPlace client.'
# environment: approvals-demo-core
strategy:
runOnce:
preDeploy:
steps:
- template: ../tasks/task-chart-setup.yml
parameters:
helm: ${{ parameters.helm }}
deploy:
steps:
- template: ../tasks/task-chart-deploy.yml
parameters:
type: data
namespace: ${{ parameters.clientBaseName }}-${{ parameters.environment }}
charts: ./charts/data
values: ./output/{{ parameters.environment }}/data.yaml
aks: ${{ parameters.aks }}

- template: ../tasks/task-chart-deploy.yml
parameters:
type: services
namespace: ${{ parameters.clientBaseName }}-${{ parameters.environment }}
charts: ./charts/services
values: ./output/${{ parameters.environment }}/services.yaml
aks: ${{ parameters.aks }}

- template: ../tasks/task-chart-deploy.yml
parameters:
type: jobs
namespace: ${{ parameters.clientBaseName }}-${{ parameters.environment }}
charts: ./charts/jobs
values: ./output/${{ parameters.environment }}/jobs.yaml
aks: ${{ parameters.aks }}

关于deployment - Azure yaml 管道 "Expected mapping end",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65328258/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com