在azure-Pipelines.yml中出现错误意外值'步骤' [英] Error Unexpected value 'steps' in azure-pipelines.yml

查看:16
本文介绍了在azure-Pipelines.yml中出现错误意外值'步骤'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在生成和部署停靠设备映像之前,我正在尝试将视频文件从GPM复制到app/dist/ASSET/IMAIES文件夹。在第27行获取意外的值‘Steps’。

如果删除复制视频文件的步骤,则YML文件工作正常。

azure-pipelines.yml

    trigger:
  branches:
    include: ['*']

pool:
  name: Default

# templates repo
resources:
  repositories:
    - repository: templates
      type: git
      name: comp.app.common.devops-templates
      ref: master

# Global Variables
variables:
  # necessary variables defined in this template
  - template: azure-templates/vars/abc-vars.yml@templates
  - name: dockerRepoName
    value: 'docker-it/library/xyz'
  # needed for k8 deployment
  - name: helmReleaseName
    value: xyz

stages:
  - steps:
    - bash: 'curl -o aa.mp4 https://gpm.mmm.com/endpoints/Application/content/xyz/bb.mp4'
      workingDirectory: '$(System.DefaultWorkingDirectory)/_hh_app/drop/app/dist/assets/images'
      displayName: 'Download Assets'

  # template to build and deploy
  - template: azure-templates/stages/angular-express-docker.yml@templates
    parameters:
      dockerRepoName: $(dockerRepoName)

    # deploy to rancher
  - template: azure-templates/stages/deploy-k8-npm.yml@templates
    parameters:
      helmReleaseName: $(helmReleaseName)

推荐答案

steps属性不应置于stage级别下。是:stage=>job=>steps

因此在定义多级YAML管道时不能将steps放在那里。

1.steps简单YAML管道可以直接放在第一级(不分阶段):

trigger:
- master

pool:
  vmImage: 'windows-latest'

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'

- script: |
    echo Add other tasks to build, test, and deploy your project.
  displayName: 'Run a multi-line script'

2.应放在多级YAML管道内的作业级:

stages:
- stage: build
  displayName: Build
  jobs:
  - job: Build
    pool:
      name: xxx
    steps:
      - task: CmdLine@2
        inputs:
          script: |
            echo Hello world

- stage: deploy
  displayName: Release
  jobs:
  - job: Release
    pool:
      name: xxx
    steps:
      - task: CmdLine@2
        inputs:
          script: |
            echo Hello world
根据您的stages:元素,您的管道将被识别为可用于构建和部署的多阶段管道。因此,您不能也不应该将steps直接放在stages:下面。

解决方案:

若要解析Unexpected value 'Steps',您应该删除steps或将它们添加到一个阶段级别:

stages:
  - stage: First
    displayName: FirstStage
    jobs:
    - job: FirstJob
      pool:
        name: xxx
      steps:
      - bash: 'curl -o aa.mp4 https://gpm.mmm.com/endpoints/Application/content/xyz/bb.mp4'
        workingDirectory: '$(System.DefaultWorkingDirectory)/_hh_app/drop/app/dist/assets/images'
        displayName: 'Download Assets'

  # template to build and deploy
  - template: azure-templates/stages/angular-express-docker.yml@templates
    parameters:
      dockerRepoName: $(dockerRepoName)

    # deploy to rancher
  - template: azure-templates/stages/deploy-k8-npm.yml@templates
    parameters:
      helmReleaseName: $(helmReleaseName)

这篇关于在azure-Pipelines.yml中出现错误意外值'步骤'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆