Попытка развернуть ionic5 angular8 pwa в aws ec2 из Azure devops YAML

#azure #amazon-ec2 #yaml #azure-pipelines

#azure #amazon-ec2 #yaml #azure-конвейеры

Вопрос:

Я новичок в Azure devops.Я пытаюсь развернуть свое приложение ionic5 angular на amazon ec2 с помощью azure pipelines.Всякий раз, когда я пытаюсь запустить конвейер, он выдает «Обнаруженные ошибки при разборе конвейера YAML: /build-ci.yml (строка: 2, Col: 3): сопоставление не ожидалось» эта ошибка. Это код файла yaml.Я здесь совсем застрял. Пожалуйста, помогите.

 trigger:
- task: CodeDeployDeployApplication@1
  inputs:
    awsCredentials: 'AWS Service Con'
    regionName: 'us-east-1'
    applicationName: 'Dev-erp-Frontend'
    deploymentGroupName: 'Dev-erp-Frontend'
    deploymentRevisionSource: 'workspace'
    revisionBundle: 'Dev-erp-Frontend-Rev'
    bucketName: 'Dev-erp-Frontend'
    fileExistsBehavior: 'OVERWRITE'
    batch: "true"
  branches:
    include:
      - master
      - dev
  paths:
    include:
      - ./*

pr:
  branches:
    include:
      - master
      - dev
  paths:
    include:
      - ./*

jobs:
  - job: Build_Job
    displayName: Build
    pool:
      vmImage: 'ubuntu-18.04'
      demands:
      - npm
    steps:
    - checkout: self
      clean: false
#    - powershell: 'npm cache clean  --force'
#      displayName: 'PowerShell Script'
#      env:
#        APPDATA: npm-cache
    - task: Npm@1
      displayName: 'Npm Install'
      inputs:
        workingDir: "./"
        command: "ci"
    - task: Npm@1
      displayName: 'Lint Client App'
      inputs:
        workingDir: "./"
        command: "custom"
        customCommand: "run lint"
      continueOnError: true
    - task: Npm@1
      displayName: 'Copy Assets'
      inputs:
        workingDir: "./"
        command: "custom"
        customCommand: "run copy-files"
      continueOnError: false
    - task: Npm@1
      displayName: 'Build Client App'
      inputs:
        workingDir: "./"
        command: "custom"
        customCommand: "run build:prod"

# Archive files
    - task: ArchiveFiles@2
      inputs:
        rootFolderOrFile: '$(Build.BinariesDirectory)' 
        includeRootFolder: true 
        archiveType: 'zip' # Options: zip, 7z, tar, wim
        archiveFile: '$(Build.ArtifactStagingDirectory)/www.zip' 
        replaceExistingArchive: true

    - task: CopyFiles@2
      inputs:
        Contents: 'www/**'
        TargetFolder: '$(build.artifactstagingdirectory)'
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact'
      inputs:
        PathtoPublish: '$(build.artifactstagingdirectory)'
        ArtifactName: 'titas-ecom-erp'
  

Комментарии:

1. Привет, @Amitabh Biswas, есть какие-нибудь обновления? Пожалуйста, не стесняйтесь сообщать мне последние новости. Или, если у вас есть какие-либо опасения, не стесняйтесь поделиться ими здесь.

2. До сих пор никаких проблем. Файл yaml работает без сбоев. Проблем нет

Ответ №1:

Мы не можем установить задачу CodeDeployDeployApplication@1 на уровне триггера, мы должны добавить задачу на уровне шагов. Вы можете обновить свое определение YAML следующим образом.

 trigger:
  branches:
    include:
      - master
      - dev
  paths:
    include:
      - ./*

pr:
  branches:
    include:
      - master
      - dev
  paths:
    include:
      - ./*

jobs:
  - job: Build_Job
    displayName: Build
    pool:
      vmImage: 'ubuntu-18.04'
      demands:
      - npm
    steps:
    - checkout: self
      clean: false
#    - powershell: 'npm cache clean  --force'
#      displayName: 'PowerShell Script'
#      env:
#        APPDATA: npm-cache

    - task: CodeDeployDeployApplication@1
      inputs:
        awsCredentials: 'AWS Service Con'
        regionName: 'us-east-1'
        applicationName: 'Dev-erp-Frontend'
        deploymentGroupName: 'Dev-erp-Frontend'
        deploymentRevisionSource: 'workspace'
        revisionBundle: 'Dev-erp-Frontend-Rev'
        bucketName: 'Dev-erp-Frontend'
        fileExistsBehavior: 'OVERWRITE'
        batch: "true"

    - task: Npm@1
      displayName: 'Npm Install'
      inputs:
        workingDir: "./"
        command: "ci"
    - task: Npm@1
      displayName: 'Lint Client App'
      inputs:
        workingDir: "./"
        command: "custom"
        customCommand: "run lint"
      continueOnError: true
    - task: Npm@1
      displayName: 'Copy Assets'
      inputs:
        workingDir: "./"
        command: "custom"
        customCommand: "run copy-files"
      continueOnError: false
    - task: Npm@1
      displayName: 'Build Client App'
      inputs:
        workingDir: "./"
        command: "custom"
        customCommand: "run build:prod"

# Archive files
    - task: ArchiveFiles@2
      inputs:
        rootFolderOrFile: '$(Build.BinariesDirectory)' 
        includeRootFolder: true 
        archiveType: 'zip' # Options: zip, 7z, tar, wim
        archiveFile: '$(Build.ArtifactStagingDirectory)/www.zip' 
        replaceExistingArchive: true

    - task: CopyFiles@2
      inputs:
        Contents: 'www/**'
        TargetFolder: '$(build.artifactstagingdirectory)'
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact'
      inputs:
        PathtoPublish: '$(build.artifactstagingdirectory)'
        ArtifactName: 'titas-ecom-erp'