【发布时间】:2020-06-11 06:14:57
【问题描述】:
一点背景:
我已经为 .NET 创建了 azure CI/CD 管道,在 CI 步骤中,有一个步骤可以吞下 css/js。不知何故,我注意到在我生成的工件中,吞噬的 css/js 没有出现。所以,根据帖子中的最后一个答案(Gulp-compiled CSS folder missing from the Azure DevOps pipeline Build Artifact
) 我设法找到生成的 css/js 的路径并将其复制到 $(Build.ArtifactStagingDirectory) (通过在 gulp 之后和发布工件任务之前添加复制文件任务)。如下图所示,您可以看到标记为蓝色框的文件夹现在已复制到$(Build.ArtifactStagingDirectory)。
现在提出问题:
我认为在发布管道中,用于将其部署到 azure 应用程序的工件是“SampleWebApplication.zip”。现在,我不确定如何将我的 css/js 文件夹复制到 azure 应用程序,因为当我看到 azure 应用程序的站点文件夹时,资产文件夹中仍然不存在这些 css 和 js 文件夹。
EDIT-1
还附加了“构建解决方案”和“发布工件”任务的 YAML
构建解决方案 YAML:-
#Your build pipeline references an undefined variable named ‘Parameters.solution’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references the ‘BuildPlatform’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
steps:
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
发布工件 YAML
#Your build pipeline references an undefined variable named ‘Parameters.ArtifactName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
steps:
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: '$(Parameters.ArtifactName)'
【问题讨论】:
-
我认为您需要检查 SampleWebApplication.zip 是否包含带有更新文件的 assets 文件夹。
-
不,它不包含。但是要检查 gulp 是否真的在创建文件,然后我将发布工件任务的“发布到路径”位置从 $(Build.ArtifactStagingDirectory) 更改为 $(build.SourcesDirectory) 然后我可以看到 gulp 编译的 CSS 和 JS 存在于assets 文件夹,但我不确定它为什么不在 .zip 中。
标签: azure continuous-integration azure-pipelines-release-pipeline