No package found with specified pattern: D:\a\r1\a\**\*.zip

后端 未结 9 1426
太阳男子
太阳男子 2021-01-04 07:25

I created a build definition in vsts with npm build and then I copy the build folder to the drop location.

The build pipeline is working fine

Then I created

相关标签:
9条回答
  • 2021-01-04 07:43

    Per Azure official document for setting up Pipelines (YAML files) for Node.js, Javascript apps from this link https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/javascript?view=azure-devops&tabs=code

    1. Configure the YAML file as below:
    trigger:
    - master
    
    pool:
      vmImage: 'ubuntu-latest'
    
    steps:
    - task: NodeTool@0
      inputs:
        versionSpec: '10.x'
      displayName: 'Install Node.js'
    
    - script: |
        npm install
        npm run build
      displayName: 'npm install and build'
    
    - task: CopyFiles@2
      inputs:
        Contents: 'build/**' # Pull the build directory (React)
        TargetFolder: '$(Build.ArtifactStagingDirectory)'
    
    - task: PublishBuildArtifacts@1
      inputs: 
        pathtoPublish: $(Build.ArtifactStagingDirectory) # dist or build files
        ArtifactName: 'www' # output artifact named www
    
    1. On the latest version of Azure Devops, edit Release under Pipeline. Note that Build section has been taken off in the latest version (as of June 2020), so some older answers/docs was not working.

    2. Click on Deploy Azure App Services and on the right panel click on ...(Expand Folder) for Package or folder Option

    3. Under Linked Artifacts => MyProject (Build) => www, select dist folder.

    Save this and then create release, this should solve the error [error]Error: No package found with the specified pattern: D:\a\r1\a\**\*.zip<br/>

    0 讨论(0)
  • 2021-01-04 07:45

    For anyone else experiencing this problem using Azure DevOps, it's useful to turn on debug mode. For your release, define the pipeline variable System.Debug with value true. That gave me this output which was much more useful:

    Now at least I know it's on my target VM and the path is probably wrong.

    0 讨论(0)
  • 2021-01-04 07:49

    First i think you should add artifacts1 then attach it to the packages2

    0 讨论(0)
  • 2021-01-04 07:49

    In my case (react app deployed as static content to app service) I needed to add a step to archive the build directory before publishing it:

    - task: ArchiveFiles@2
      inputs:
        rootFolderOrFile: '$(System.DefaultWorkingDirectory)/build' 
        includeRootFolder: false 
        archiveType: 'zip'
        archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    
    - publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
      artifact: '$(Build.BuildId)'
    
    
    0 讨论(0)
  • 2021-01-04 07:52

    I used the below task in Azure DevOps release yaml pipeline for deployment of azure function app and set the package to $(System.DefaultWorkingDirectory) and it worked for me.

    - task: AzureFunctionApp@1
                    inputs:
                      azureSubscription: XXXXXXXXX
                      appType: 'functionApp'
                      appName: 'funcapp-test'
                      package: '$(System.DefaultWorkingDirectory)'
                      appSettings: 
                      deploymentMethod: 'auto'
    
    0 讨论(0)
  • 2021-01-04 07:56

    In my case I use azure template but change vmImage: "windows-latest", When I check logs, find out build command didn't run so I figure out I should change default script of install and build to separate script

    trigger:
    - main
    
    pool:
      vmImage: 'windows-latest'
    
    variables:
      buildFolder: 'build'
    
    steps:
    - task: NodeTool@0
      inputs:
        versionSpec: '10.x'
      displayName: 'Install Node.js'
    
    - script: |
        npm install
      displayName: 'npm install'
    
    - script: |
        npm run build
      displayName: 'npm build'
    
    - task: CopyFiles@2
      inputs:
        contents: 'build/**'
        targetFolder: '$(Build.ArtifactStagingDirectory)'
        cleanTargetFolder: true
    
    - task: ArchiveFiles@2
      inputs:
        rootFolderOrFile: $(Build.ArtifactStagingDirectory)
        archiveType: 'zip'
        archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
        includeRootFolder: false
    
    - task: PublishBuildArtifacts@1
      inputs:
        pathtoPublish: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
        artifactName: 'drop'
        publishLocation: 'Container'
    
    0 讨论(0)
提交回复
热议问题