首页 > 解决方案 > Azure Devops Pipeline - PublishPipelineArtifact@1 - ##[错误]无法加载符号/硬链接文件

问题描述

你好

发布管道工件时出现以下错误

##[错误]无法加载符号/硬链接文件。检查“fsutil 行为查询 SymlinkEvaluation”以确保行为正确。

管道(PHP Laravel 工件)

PHP

测试并打包您的 PHP 项目。

添加运行测试、保存构建工件、部署等的步骤:

https://docs.microsoft.com/azure/devops/pipelines/languages/php

扳机:

  • 掌握

池:vmImage:'ubuntu-latest'

变量:php版本:7.2

脚步:

  • 脚本:| sudo update-alternatives --set php /usr/bin/php$(phpVersion) sudo update-alternatives --set phar /usr/bin/phar$(phpVersion) sudo update-alternatives --set phpdbg /usr/bin/phpdbg $(phpVersion) sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion) sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion) php - version displayName: '使用 PHP 版本 $(phpVersion)'

  • 脚本:|
    sudo composer self-update composer global 需要 laravel/installer composer update --no-interaction --prefer-dist --no-suggest composer --version 'Deploy Laravel'

  • 任务:PublishPipelineArtifact@1 输入:targetPath:'$(Pipeline.Workspace)' 工件:'PriVet_Backend_$(Build.BuildId)' publishLocation:'pipeline'

从日志:

2020-07-01T08:13:09.8456382Z 错误,System.IO.FileLoadException:无法加载符号/硬链接文件。检查“fsutil 行为查询 SymlinkEvaluation”以确保行为正确。2020-07-01T08:13:09.8457580Z ---> System.IO.FileNotFoundException: 找不到文件'/home/vsts/work/1/s/www/vendor/amphp/parallel-functions/docs/asset' . 2020-07-01T08:13:09.8458469Z 文件名:'/home/vsts/work/1/s/www/vendor/amphp/parallel-functions/docs/asset' 2020-07-01T08:13:09.8459102Z 在Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func2 errorRewriter) 2020-07-01T08:13:09.8459726Z at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode) 2020-07-01T08:13:09.8460360Z at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) 2020-07-01T08:13:09.8461407Z at Microsoft.VisualStudio.Services.Content.Common.FileStreamUtils.OpenFileStreamForAsync(String filePath, FileMode mode, FileAccess fileAccess, FileShare fileShare, FileOptions extraOptions) 2020-07-01T08:13:09.8462269Z at Microsoft.VisualStudio.Services.BlobStore.Common.ChunkerHelper.CreateFromFileAsync(IFileSystem fileSystem, String path, CancellationToken cancellationToken, Boolean configureAwait) 2020-07-01T08:13:09.8463250Z at Microsoft.VisualStudio.Services.BlobStore.Common.FileBlobDescriptor.CalculateAsync(IFileSystem fileSystem, String rootDirectory, Boolean chunkDedup, String relativePath, FileBlobType fileBlobType, CancellationToken cancellationToken) 2020-07-01T08:13:09.8464322Z at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.GetFileBlobDescriptorAsync(String rootDirectory, Boolean chunkDedup, PageItem pageItem, CancellationToken cancellationToken) 2020-07-01T08:13:09.8465253Z at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.GetFileBlobDescriptorAsync(String rootDirectory, Boolean chunkDedup, PageItem pageItem, CancellationToken cancellationToken) 2020-07-01T08:13:09.8466173Z at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.<>c__DisplayClass26_0.<<PaginateAndProcessFilesHelperAsync>b__0>d.MoveNext() 2020-07-01T08:13:09.8467610Z --- End of stack trace from previous location where exception was thrown --- 2020-07-01T08:13:09.8468136Z at Microsoft.VisualStudio.Services.Content.Common.NonSwallowingActionBlock.<>c__DisplayClass5_01.<b__0>d.MoveNext() 2020-07-01T08:13:09.8468799Z --- 从先前引发异常的位置结束堆栈跟踪 --- Microsoft 的 2020-07-01T08:13:09.8469476Z。 VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.PaginateAndProcessFilesHelperAsync(字符串 sourceDirectory,布尔 chunkDedup,IEnumerable1 pathsInDir, Action1 hashCompleteCallback, CancellationToken cancelToken) 2020-07-01T08:13:09.8470201Z 在 Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.<>c__DisplayClass22_0.<b__0>d.MoveNext() 2020-07-01T08:13:09.8529135 Z 信息,已处理 7472 个文件。2020-07-01T08:13:09.8542251Z 信息,7572 个文件已处理。2020-07-01T08:13:09.8546157Z 信息,已处理 7672 个文件。2020-07-01T08:13:09.8569555Z 信息,7772 个文件已处理。2020-07-01T08:13:09.8596993Z 信息,7872 个文件已处理。2020-07-01T08:13:09.8633894Z 信息,已处理 7972 个文件。2020-07-01T08:13:09.8643831Z 信息,已处理 8072 个文件。2020-07-01T08:13:09.8664592Z 信息,已处理 8172 个文件。2020-07-01T08:13:09.8664847Z 信息,已处理 8272 个文件。2020-07-01T08:13:09.8665070Z 信息,已处理 8372 个文件。2020-07-01T08:13:09.8665268Z 信息,已处理 8472 个文件。2020-07-01T08:13:09.8665472Z 信息,已处理 8572 个文件。2020-07-01T08:13:09.8667556Z 信息,已处理 8672 个文件。2020-07-01T08:13:11.7076135Z 信息,ApplicationInsightsTelemetrySender 将 2 个事件与 X-TFS-Session f56bb233-a941-4e13-97dc-2efe60c398fe 相关联 2020-07-01T08:13:11.7128821Z ##[错误]无法加载符号/硬链接文件。检查“fsutil 行为查询 SymlinkEvaluation”以确保行为正确。2020-07-01T08:13:11.7138924Z ##[debug]已处理:##vso[task.logissue type=error;]无法加载符号/硬链接文件。检查“fsutil 行为查询 SymlinkEvaluation”以确保行为正确。2020-07-01T08:13:11.7153064Z ##[debug]Processed:##vso[task.complete result=Failed;] 2020-07-01T08:13:11。1.<<CreateNonSwallowingFunc>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.PaginateAndProcessFilesHelperAsync(String sourceDirectory, Boolean chunkDedup, IEnumerable1 pathsInDir,Action 1 hashCompleteCallback, CancellationToken cancellationToken) at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.<>c__DisplayClass22_0.<<PaginateAndProcessFiles>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Services.Content.Common.ExceptionExtensions.ReThrow(Exception ex) at Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.<>c__DisplayClass22_0.<<PaginateAndProcessFiles>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Services.Content.Common.NonSwallowingActionBlock.<>c__DisplayClass5_01.<b__0>d.MoveNext() --- 堆栈跟踪从先前引发异常的位置结束 --- 在 Microsoft.VisualStudio.Services.BlobStore.Common.PrecomputedHashesGenerator.PaginateAndProcessFiles(String sourceDirectory, Boolean chunkDedup,IEnumerable1 pages, CancellationToken cancellationToken, Action1 hashCompleteCallback) 在 Microsoft.VisualStudio.Services.BlobStore.WebApi.DedupManifestArtifactClient.PublishAsync(String fullPath, ArtifactPublishOptions artifactPublishOptions, String manifestFileOutputPath, CancellationToken cancellationToken) 在 Agent.Plugins.PipelineArtifact.PipelineArtifactServer.<>c__DisplayClass2_0.<b__1>d.MoveNext( ) --- 从先前引发异常的位置结束堆栈跟踪 --- 在 Microsoft.VisualStudio.Services.BlobStore.Common.Telemetry.BlobStoreClientTelemetry.MeasureActionAsync[TResult](BlobStoreTelemetryRecord 记录,Func1 actionAsync) at Microsoft.VisualStudio.Services.Content.Common.ExceptionExtensions.ReThrow(Exception ex) at Microsoft.VisualStudio.Services.BlobStore.Common.Telemetry.BlobStoreClientTelemetry.MeasureActionAsync[TResult](BlobStoreTelemetryRecord record, Func1 actionAsync) 在 Agent.Plugins.PipelineArtifact.PipelineArtifactServer.UploadAsync(AgentTaskPluginExecutionContext context, Guid projectId, Int32 pipelineId, String name, String source, CancellationToken cancellationToken) 在 Agent.Plugins.PipelineArtifact.PublishPipelineArtifactTaskV1.ProcessCommandInternalAsync(AgentTaskPluginExecutionContext context, CancellationToken token) 在Agent.PluginHost.Program.Main(String[] args) 2020-07-01T08:13:11.7255180Z ##[section]Finishing: PublishPipelineArtifact

标签: phplaravelazure-devops

解决方案


当 PublishPipelineArtifact 任务发布包含符号链接的文件夹时。它不保留符号链接文件。相反,原始文件(符号链接指向的)将被复制到工件中。

从您的上述错误来看,似乎/home/vsts/work/1/s/www/vendor/amphp/parallel-functions/docs/asset找不到符号文件指向的原始文件。

您可以运行 ls -l symboliclinkna bash 任务(即。ls -l $(Build.SourcesDirectory)/www/vendor/amphp/parallel-functions/docs/asset)来检查符号链接指向的位置。并确保原始文件存在。

/home/vsts/work/1/s/www/vendor/amphp/parallel-functions/docs/asset如果Artifacts中可以省略文件夹中的文件。您可以在定义为目标路径的同一目录中添加.artifactignore 文件,以忽略符号文件及其内容。


推荐阅读