user15464793
user15464793

Reputation: 149

Datafactory npm validation error (yml ci/cd pipelines)

I've been followings microsoft's documentation for the new yml ci-cd datafactory deployment. However, I keep getting a validation error when trying to implement CI/CD pipelines for Azure Data Factory with a yml file, after the installation of npm. I get the following error message:

Error: Command failed: node  /home/vsts/work/1/s/DataFactories/joaov1/build/downloads/main.js validate /home/vsts/work/1/s DataFactories/joaov1/subscriptions/000000-0000-0000-0000-864d437bd294/resourceGroups/rg-hi-joaov1-dev/providers/Microsoft.DataFactory/factories/adf-client-joaov1-dev

Execution finished....
Found npm debug log, make sure the path matches with the one in npm's output: /home/vsts/.npm/_logs/2021-12-01T21_20_55_974Z-debug.log

I'm quite confident that it is a an issue with the path, but after hours of research online I still can't get it to work... My file structure is the following:

joaov1 is my datafactory name

And my code is as follows:

# Sample YAML file to validate and export an ARM template into a build artifact
# Requires a package.json file located in the target repository

trigger:
- master

# parameters:
# - name: 'dev'
# - name: 'test'
# - name: 'prod'


pool:
  vmImage: 'ubuntu-latest'

steps:

# Installs Node and the npm packages saved in your package.json file in the build

- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js'

- task: Npm@1
  inputs:
    command: 'install'
    workingDir: '$(Build.Repository.LocalPath)/DataFactories/joaov1/build' #replace with the package.json folder
    verbose: true
  displayName: 'Install npm package'

# Validates all of the Data Factory resources in the repository. You'll get the same validation errors as when "Validate All" is selected.
# Enter the appropriate subscription and name for the source factory.

- task: Npm@1
  inputs:
    command: 'custom'
    workingDir: '$(Build.Repository.LocalPath)/DataFactories/joaov1/build' #replace with the package.json folder
    customCommand: 'run build validate $(Build.Repository.LocalPath)/DataFactories/joaov1/subscriptions/000000-0000-0000-974d-864d437bd294/resourceGroups/rg-hi-joaov1-dev/providers/Microsoft.DataFactory/factories/adf-client-joaov1-dev'
  displayName: 'Validate'

# Validate and then generate the ARM template into the destination folder, which is the same as selecting "Publish" from the UX.
# The ARM template generated isn't published to the live version of the factory. Deployment should be done by using a CI/CD pipeline. 

- task: Npm@1
  inputs:
    command: 'custom'
    workingDir: '$(Build.Repository.LocalPath)/DataFactories/joaov1/build' #replace with the package.json folder
    customCommand: 'run build export $(Build.Repository.LocalPath)/DataFactories/joaov1/subscriptions/000000-0000-4aab-974d-864d437bd294/resourceGroups/rg-hi-joaov1-dev/providers/Microsoft.DataFactory/factories/adf-client-joaov1-dev "ArmTemplate"'
  displayName: 'Validate and Generate ARM template'

# Publish the artifact to be used as a source for a release pipeline.

- task: PublishPipelineArtifact@1
  inputs:
    targetPath: '$(Build.Repository.LocalPath)/DataFactories/joaov1/build/ArmTemplate' #replace with the package.json folder
    artifact: 'ArmTemplates'
    publishLocation: 'pipeline' 

Any help would be great, Thank you so much, Joao

Upvotes: 0

Views: 972

Answers (1)

Desmond
Desmond

Reputation: 1368

You ADF Build tasks Node version should be changed from 10.X to 14.X.

- task: NodeTool@0
  inputs:
    versionSpec: '14.x'
  displayName: 'Install Node.js'

Upvotes: 1

Related Questions