在我的 azure devops 项目中,我使用模板创建了一个管道。这是我的构建管道的主要 yaml 文件
name: Test-$(Date:yyyyMMdd)$(Rev:.r)
resources:
repositories:
- repository: api
type: git
name: porject/api
ref: master
- repository: front
type: git
name: project/front
ref: master
- repository: strapi
type: git
name: project/strapi
ref: master
trigger:
branches:
include:
- master
pool:
vmImage: 'ubuntu-latest'
workspace:
clean: all
variables:
- name: workingDir
value: project
- name: tfVersion
value: 0.12.29
- name: backendServiceGCP
value: test
- name: backendGCPBucketName
value: test
- name: tfpath
value: test
- name: env
value: dev
stages:
- stage: Terraform
jobs:
- job: Build
displayName: Build Terraform Infra
steps:
# Set and Export env var for api version to deploy
- template: templates/fetch-tag.yml
parameters:
repo: 'api'
envVar: TERRAFORM_API_TAG
# Set and Export env var for front version to deploy
- template: templates/fetch-tag.yml
parameters:
repo: 'front'
envVar: TERRAFORM_FRONT_TAG
# Set and Export env var for strapi version to deploy
- template: templates/fetch-tag.yml
parameters:
repo: 'strapi'
envVar: TERRAFORM_STRAPI_TAG
# Init Terraform providers
- template: templates/tf-init.yml
parameters:
backendServiceGCP: '$(backendServiceGCP)'
backendGCPBucketName: '$(backendGCPBucketName)'
workingDir: '$(workingDir)'
variableFilePath: $(buildSubscription)-common.tfvars
# Plan Terraform Infra to Deploy
- template: templates/tf-plan.yml
parameters:
backendServiceGCP: '$(backendServiceGCP)'
workingDir: '$(workingDir)'
variableFilePath: $(buildSubscription)-common.tfvars
# Publish Public Artifact with Terraform ressources to deploy
- template: templates/publish-artifact.yml
parameters:
tfpath: '$(tfpath)'
当我尝试运行管道时,出现以下错误:
Encountered error(s) while parsing pipeline YAML:
Job Build: The step name version appears more than once. Step names must be unique within a job.
Job Build: The step name version appears more than once. Step names must be unique within a job.
Job Build: The step name version appears more than once. Step names must be unique within a job.
Job Build: The step name version appears more than once. Step names must be unique within a job.
Job Build: The step name version appears more than once. Step names must be unique within a job.
我真的不明白为什么。这是我在名为的管道中使用的模板示例publish-artifact.yml
:
parameters:
tfPath: ''
steps:
- task: CopyFiles@2
inputs:
sourceFolder: ${{ parameters.tfpath }}
contents: |
tfplan
**/*.tf
**/*.tfvars
**/*.json
!**/.terraform
**/*.sh
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: tf
我在工作名称上做错了什么?