skip to Main Content

I am attempting to build a Pipeline in AzureDevOps (without using the classic editor). I have so far created the following yaml code:

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- adf_publish

pool:
  vmImage: ubuntu-latest

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

- script: |
    echo Add other tasks to build, test, and deploy your project.
    echo See https://aka.ms/yaml
  displayName: 'Run a multi-line script'
- task: PublishBuildArtifacts@1
  inputs:
- task: AzurePowerShell@5
  inputs:
    azureSubscription: 'NewConnectionName'
    ScriptType: 'FilePath'
    ScriptPath: '$(System.DefaultWorkingDirectory)/_Azure Data Factory-CP/drop/pre-and post-deployment.ps1'
    ScriptArguments: '-armTemplate "$(System.DefaultWorkingDirectory)/_Azure Data Factory-CP/drop/ARMTemplateForFactory.json" -ResourceGroupName $(ResourceGroup) -DataFactoryName $(DataFactory) -predeployment $true -deleteDeployment $false'
    azurePowerShellVersion: 'LatestVersion'
    PathtoPublish: 'caplogic-warehouse-dev-df'
    ArtifactName: 'drop'
    publishLocation: 'Container'

When I validate the code I get the following error:

/my-azure-pipelines.yml (Line: 21, Col: 10): Unexpected value ''

This is must experience with yaml and therefore not sure where to start troubleshooting

Any thoughts on where the error is with the code?

2

Answers


  1. task: PublishBuildArtifacts@1
    

    Your "inputs" param is empty, remove the task if you’re not using it or add the required params : https://learn.microsoft.com/fr-fr/azure/devops/pipelines/tasks/reference/publish-build-artifacts-v1?view=azure-pipelines

    Login or Signup to reply.
  2. According to your yaml, it seems that you added the AzurePowerShell@5 task to the wrong line, causing the PublishBuildArtifacts@1 task to be destroyed.

    enter image description here

    It should be:

    - task: AzurePowerShell@5
      inputs:
        azureSubscription: 'NewConnectionName'
        ScriptType: 'FilePath'
        ScriptPath: '$(System.DefaultWorkingDirectory)/_Azure Data Factory-CP/drop/pre-and post-deployment.ps1'
        ScriptArguments: '-armTemplate "$(System.DefaultWorkingDirectory)/_Azure Data Factory-CP/drop/ARMTemplateForFactory.json" -ResourceGroupName $(ResourceGroup) -DataFactoryName $(DataFactory) -predeployment $true -deleteDeployment $false'
        azurePowerShellVersion: 'LatestVersion'
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: 'caplogic-warehouse-dev-df'
        ArtifactName: 'drop'
        publishLocation: 'Container'
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search