Kumar Vivek
Kumar Vivek

Reputation: 381

Azure DevOps pipeline takes long time for copying node modules

Have been setting up an Azure DevOps pipeline for bundling a function and deploying it over to GCP (deplyoment part is working fine and no issues).

But the overall process takes a lot of time, is there any suggestion how can we reduce the time of deployment?

azure-pipeline.yaml

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: CopyFiles@2
  inputs:
    Contents: '**'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: Npm@1
  inputs:
    command: 'install'
    workingDir: '$(Build.ArtifactStagingDirectory)/functions'
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

While release pipeline is just reading the drop and pushing it via shell script.

enter image description here

The overall pipeline takes a lot of time in copying the nodefile after npm install to the drop (over 10 minutes). Is there any way make this process fast?

Upvotes: 1

Views: 4089

Answers (1)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51103

According to your YAML file, you have included all files when copy and publish to drop folder.

The alternative is choosing necessary files and excluding node_modules folder from publishing to server. This will help to reduce time. A sample UI setting for reference.:

Copy Files task

Source Folder: $(Build.SourcesDirectory)

Contents:

**\**
!**\node_modules\**

Target Folder: $(build.artifactstagingdirectory)

enter image description here

Publish Build Artifacts task

Publish Build Artifacts task: $(build.artifactstagingdirectory)

Artifact Name: drop

enter image description here

Upvotes: 2

Related Questions