Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
Azure DevOps Services | Azure DevOps Server | Azure DevOps Server 2022
Notitie
We raden u aan pijplijnartefacten te downloaden en pijplijnartefacten te publiceren voor snellere prestaties.
Met Azure Artifacts kunnen teams feeds en upstream-bronnen gebruiken om hun afhankelijkheden te beheren. U kunt Azure Pipelines gebruiken om verschillende soorten artefacten te publiceren en te downloaden als onderdeel van uw CI/CD-werkstroom.
Artefacten publiceren
Artefacten kunnen worden gepubliceerd in elke fase van uw pijplijn. U kunt YAML of de klassieke Azure DevOps-editor gebruiken om uw pakketten te publiceren.
- powershell: gci env:* | sort-object name | Format-Table -AutoSize | Out-File $env:BUILD_ARTIFACTSTAGINGDIRECTORY/environment-variables.txt
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: '**/$(BuildConfiguration)/**/?(*.exe|*.dll|*.pdb)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
- pathToPublish: het pad van uw artefact. Dit kan een absoluut of een relatief pad zijn. Jokertekens worden niet ondersteund.
- artifactName: de naam van uw artefact.
Notitie
Zorg ervoor dat u geen gereserveerde mapnamen gebruikt bij het publiceren van uw artefact. Zie Toepassingsmappen voor meer informatie.
Voorbeeld: Meerdere taken gebruiken
- powershell: gci env:* | sort-object name | Format-Table -AutoSize | Out-File $env:BUILD_ARTIFACTSTAGINGDIRECTORY/environment-variables.txt
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: '**/$(BuildConfiguration)/**/?(*.exe|*.dll|*.pdb)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop1
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop2
- pathToPublish: het pad van uw artefact. Dit kan een absoluut of een relatief pad zijn. Jokertekens worden niet ondersteund.
- artifactName: de naam van uw artefact.
Voorbeeld: Binaire bestanden kopiëren en publiceren
- powershell: gci env:* | sort-object name | Format-Table -AutoSize | Out-File $env:BUILD_ARTIFACTSTAGINGDIRECTORY/environment-variables.txt
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: '**/$(BuildConfiguration)/**/?(*.exe|*.dll|*.pdb)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
- sourceFolder: de map met de bestanden die u wilt kopiëren. Als u dit leeg laat, wordt het kopiëren uitgevoerd vanaf $(Build.SourcesDirectory).
- inhoud: Bestandspaden die moeten worden opgenomen als onderdeel van de kopie.
- targetFolder: doelmap.
- pathToPublish: de map of het bestandspad om te publiceren. Dit kan een absoluut of een relatief pad zijn. Jokertekens worden niet ondersteund.
- artifactName: de naam van het artefact dat u wilt maken.
Notitie
Zorg ervoor dat u geen gereserveerde naam gebruikt voor artifactName , zoals Bin of App_Data. Zie ASP.NET webprojectmapstructuur voor meer informatie.
Notitie
Build.ArtifactStagingDirectory het pad wordt na elke build opgeschoond. Als u dit pad gebruikt om uw artefact te publiceren, moet u ervoor zorgen dat u vóór de publicatiestap de inhoud kopieert die u in deze map wilt publiceren.
Artefacten downloaden
- powershell: gci env:* | sort-object name | Format-Table -AutoSize | Out-File $env:BUILD_ARTIFACTSTAGINGDIRECTORY/environment-variables.txt
- task: DownloadBuildArtifacts@1
inputs:
buildType: 'current' # Options: 'current' | 'specific'. Specify which build artifacts will be downloaded: `current` or from a specific build
downloadType: 'single' # Options: 'single' | 'specific'. Choose whether to download a single artifact or all artifacts of a specific build.
artifactName: 'drop' # Required when downloadType == single. The name of the artifact that will be downloaded.
downloadPath: '$(System.ArtifactsDirectory)' # Path on the agent machine where the artifacts will be downloaded. Default: $(System.ArtifactsDirectory).
Notitie
Als u een implementatietaak gebruikt, kunt u verwijzen naar uw buildartefacten met behulp van $(Agent.BuildDirectory).< Zie Agentvariabelen voor meer informatie.
Wanneer de pijplijnuitvoering is voltooid, gaat u naar Samenvatting om uw artefact te verkennen of te downloaden.
Een specifiek artefact downloaden
steps:
- task: DownloadBuildArtifacts@1
displayName: 'Download Build Artifacts'
inputs:
buildType: specific # Options: 'current' | 'specific'. Specify which build artifacts will be downloaded: `current` or from a specific build
project: 'xxxxxxxxxx-xxxx-xxxx-xxxxxxxxxxx' # Required when buildType == specific. Project ID.
pipeline: 20 # Required when buildType == specific. Build pipeline.
buildVersionToDownload: specific # Options: 'latest' | 'latestFromBranch' | 'specific'. Required when buildType == specific. Build version to download.
buildId: 128 # Required when buildType == specific && buildVersionToDownload == specific. Build ID.
artifactName: drop # The name of the artifact that will be downloaded.
extractTars: false # boolean. Extract all files that are stored inside tar archives.
Tips
Schakel IIS-basisverificatie uit als u Azure DevOps Server gebruikt om verificatie met uw persoonlijke toegangstoken toe te staan. Zie Waarom is mijn PAT gestopt voor meer informatie?.
Gebruik slashes in bestandspadargumenten. Backslashes werken niet in macOS-/Linux-agents.
Buildartefacten worden opgeslagen in een Windows-bestandssysteem, waardoor alle UNIX-machtigingen verloren gaan, inclusief de uitvoeringsbit. Mogelijk moet u de juiste UNIX-machtigingen herstellen nadat u uw artefacten hebt gedownload uit Azure Pipelines.
Build.ArtifactStagingDirectoryenBuild.StagingDirectoryzijn uitwisselbaar.Build.ArtifactStagingDirectoryhet pad wordt na elke build opgeschoond.Als u een build verwijdert die is gekoppeld aan pakketten die zijn gepubliceerd naar een bestandsshare, wordt alle artefacten in dat UNC-pad verwijderd.
Als u uw pakketten publiceert naar een bestandsshare, moet u ervoor zorgen dat u toegang verleent tot de buildagent.
Zorg ervoor dat u AZURE Artifacts-domein-URL's en IP-adressen toestaat als uw organisatie een firewall gebruikt.
Verwante artikelen:
- Publish and download artifacts in Azure Pipelines (Artefacten publiceren en downloaden in Azure-pijplijnen)
- Uw klassieke pijplijn met meerdere fasen definiëren
- Risico's beperken bij het gebruik van privépakketfeeds
Hulpprogramma: Bestanden kopiëren
Hulpprogramma: Build-artefacten publiceren
Hulpprogramma: Build-artefacten downloaden