Azure Devops CI/CD Build Artifact missing dist folder

Viewed 45

Maybe someone can explain me what I'm doing wrong.

I have multiple task in azure-pipeline. One of them is npm build which produces dist folder then I have MSBuild after build I'm copying dist folder inside the $(build.stagingDirectory) and then build and publish artifact. In published drop I see two folders one with my project where copied files are presented and second one folder contains .zip file which have similar files as my project except dist folder. And from what I understand on the Azure server is published content of this .zip where my dist folder is missing. Maybe someone can explain how to copy dis folder inside created .zip ??

Sharing my pipeline fragment

- task: Npm@1
  inputs:
    command: 'custom'
    workingDir: 'MyProject/story/'
    customCommand: 'run-script build'             
- task: gulp@0
  inputs:
    gulpFile: 'MyProject/gulpfile.js'
    targets: 'prod'
    gulpjs: 'node_modules/gulp/bin/gulp.js'
    enableCodeCoverage: false

- task: MSBuild@1
  inputs:
    solution: 'MyProject.sln'
    msbuildVersion: '16.0'
    msbuildArguments: '/p:DeployOnBuild=true /p:MarkWebConfigAssistFilesAsExclude=false /p:TransformWebConfigEnabled=false /p:AutoParameterizationWebConfigConnectionStrings=False /p:ExcludeFoldersFromDeployment="App_Data;Media;build" /p:ExcludeFilesFromDeployment="gulpfile.js;package.json;tsconfig.json;tslint.json" /p:IncludeSetAclProviderOnDestination=False /p:OutDir="$(build.stagingDirectory)" /p:WebPublishMethod=Package /p:PackageAsSingleFile=true' 

- task: CopyFiles@2
  inputs:
    SourceFolder: '$(Build.SourcesDirectory)\MyProject\story\dist'
    Contents: '**'
    TargetFolder: '$(build.stagingDirectory)\_PublishedWebsites\MyProject\story\dist'
    OverWrite: true
    
- task: PublishPipelineArtifact@0
  displayName: 'Publish pipeline artifact'
  inputs:
    artifactName: 'drop'
    targetPath: '$(build.stagingDirectory)'
1 Answers

Based on your description and concern, it is suggested that you could add the "extract task" task before your "Copy file" task to help uncompression the zip first to see if it works.

By adding the "extract task" task will help you get the specified files from your zip. Here is the task sample for your reference.

- task: ExtractFiles@1
  inputs:
    archiveFilePatterns: '$(Build.SourcesDirectory)\MyProject\*.zip'
    cleanDestinationFolder: true
    overwriteExistingFiles: false
Related