简体   繁体   中英

Azure build pipeline and release pipeline nodejs

I have a azure build pipeline and release pipeline. I am facing issue in the Publish Build Artifact. in the build pipeline the publish build artifact are creating properly in the default "drop" directory.

When I download that artifact in the release pipeline the publish file are downloading in the home/wwwroot/apservicename/drop on which the service are throwing error

You do not have permission to view this directory or page.

It means my publish artifact are not downloading in the "home/wwwroot" directory.

build pipeline

   # Node.js
   # Build a general Node.js project with npm.
   # Add steps that analyze code, save build artifacts, deploy, and more:
   # https://learn.microsoft.com/azure/devops/pipelines/languages/javascript
   
   trigger:
   - main
   
   pool:
     vmImage": ubuntu-latest
   
   steps:
   - task: NodeTool@0
     inputs:
       versionSpec: '12.x'
     displayName: 'Install Node.js'
   
   - script: |
       npm install
     displayName: 'npm install and build'
   
   - task: ArchiveFiles@2
     inputs:
       rootFolderOrFile: '$(Build.BinariesDirectory)'
       includeRootFolder: true
       archiveType: 'zip'
       archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
       replaceExistingArchive: true
   - task: PublishBuildArtifacts@1
     inputs
       PathtoPublish: "."
       publishLocation: Container"
   
   

release pipeline

   steps:
   - task: DownloadBuildArtifacts@0
     displayName: 'Download Build Artifacts'
     inputs:
       "buildType": specific
       project: 'f736e2aa-631d-4bc0-a468-f8c8d1b3713a'
       "pipeline": 15
       "downloadType": specific
       "downloadPath": .
       "extractTars": false

What I am missing?

The artifact name will always be a part of the path, as it's conceivable that the build(s) that precede this deployment may publish more than one artifact.

So, your deployment job will need to provide the artifact path, but you could try this - in your variables section:

variables: ... artifactName: 'APP-FE' then in your publish phase:

      - task: PublishBuildArtifacts@1
        displayName: "Upload Artifacts"
        inputs:
          PathtoPublish: 
     '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
          ArtifactName: $(artifactName)
          publishLocation: 'Container'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM