因此,我尝试将参数提交到我的模板部署中,但不确定其他参数是否按预期工作只是新的参数不起作用,但是如果我将其设置为没有参数的布尔值,则它可以工作。
似乎没有发生一些变量替换,我只是不知道为什么它一定很简单,但我就是找不到
这usek8s
不起作用,来自变量选项卡的图像
来自 azure-pipelines.yml 的片段,当它不起作用时
- template: yml/pipeline-templates/deployment.yaml@parent
parameters:
usek8s: $(usek8s)
stageId: Deploy_Dev
vmImage: $(vmVersion)
environment: 'dev'
targetBranch: 'master'
namespace: $(k8sNamespace)
imagePullSecret: $(imagePullSecret)
containerRegistry: $(dockerRegistryServiceConnection)
tag: $(tag)
imageRepository: $(imageRepository)
kubernetesServiceConnection: $(k8sConnectionDev)
dependsOn: Build_Docker_Deventer
azure-pipelines.yml 的片段,当它工作时
- template: yml/pipeline-templates/deployment.yaml@parent
parameters:
usek8s: false
stageId: Deploy_Dev
vmImage: $(vmVersion)
environment: 'dev'
targetBranch: 'master'
namespace: $(k8sNamespace)
imagePullSecret: $(imagePullSecret)
containerRegistry: $(dockerRegistryServiceConnection)
tag: $(tag)
imageRepository: $(imageRepository)
kubernetesServiceConnection: $(k8sConnectionDev)
dependsOn: Build_Docker_Deventer
来自父模板的片段
parameters:
- name: usek8s
displayName: 'Use k8s deploy process?'
type: boolean
default: false
- name: stageId
- name: vmImage
- name: targetBranch
- name: environment
- name: namespace
- name: imagePullSecret
- name: containerRegistry
- name: tag
- name: imageRepository
- name: kubernetesServiceConnection
- name: dependsOn
default: []
stages:
- stage: ${{ parameters.stageId }}
displayName: '${{ parameters.stageId }}'
dependsOn: ${{ parameters.dependsOn }}
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/${{ parameters.targetBranch }}'), eq(${{ parameters.usek8s }}, true))
jobs:
我得到的错误