我想设置VersionSuffixfromBuild.Sourcebranch但这失败了,因为SourceBranchcontains refs/heads/<branchname>。
- task: DotNetCoreCLI@2
condition: succeeded()
inputs:
command: 'pack'
versioningScheme: ByPrereleaseNumber
majorVersion: '0'
minorVersion: '1'
patchVersion: '1'
packTimezone: 'utc'
buildProperties: VersionSuffix=$(Build.SourceBranch)-$(Build.BuildNumber)
Run Code Online (Sandbox Code Playgroud)
我只想在 中添加.Replace('/','_')一些类似的语句$(Build.SourceBranch),但在表达式语法中找不到任何关于如何执行此操作的内容。
发送另一个字符串(即VersionSuffixRaw)并在 .csproj 中创建VersionSuffixwith不起作用String.Replace;由于某种原因,它只是被忽略了。
注意:有Build.SourceBranchNamewhich 具有分支名称的最后一部分,因此如果SourceBranchis refs/heads/feature/foo,SourceBranchName将是foo。但是,分支 namdfeature/JIRA-123_foo_unittest将不起作用,因为 _ 在版本字符串中无效。
我想V.1.0.00在 Azure DevOps 的持续交付中更改发布名称,例如手动发布,但如果没有这个$(rev:r),我将无法删除或更改命名,我该如何使用自定义名称?
默认名称: Release- $(rev:r)
必填名称: V.1.0.0
azure continuous-deployment devops azure-devops azure-pipelines
我已为 Azure Pipelines 中的自动构建配置了我的 github 项目。在“管道/构建/”下,我可以单击“...”并选择“状态徽章”。
在管道内部,已经测量了代码覆盖率:我可以选择一个特定的构建,然后转到“代码覆盖率”选项卡。但是,我找不到任何指向覆盖徽章的链接。它是由 Azure Devops 提供的吗?或者是否有任何与 Azure Devops 集成的免费工具来提供此功能?
我们有一个 VS 解决方案,目前在Azure DevOps上使用托管 VS2017代理。我们现在想将我们的解决方案升级到VS2019。但是,我看不到任何修改/更新Azure DevOps管道以使用windows-2019代理的方法。它似乎仅在创建新的Azure DevOps管道时可用。
有没有办法将我们当前的Azure DevOps VS2017 管道修改/更新为 2019 托管代理,而无需从头开始重新创建我们的管道?
更新
从下面的截图中可以看出,VS2019 没有出现在可用代理池的下拉列表中。
我尝试了几天来使用 Azure DevOps Pipeline 发布我的 ClickOnce 应用程序。在详细介绍之前,我想从我的发布视图中执行以下操作:
我从一个工件和 2 个发布阶段开始,config.deploy在我的 Staging 阶段使用 staging 变量修改config.deploy文件,并在我的 Production 阶段使用生产变量修改文件。部署工作正常,但由于哈希检查系统,应用程序的安装无法正常工作。
所以我决定用 2 个工件创建 2 个版本。我drop_staging在第一次构建和drop_production第二次构建期间将经典 drop 重命名为 a 。我希望构建系统 (MSBuild) 能够在构建和发布过程中选择正确的app.Debug.configthenapp.Release.config文件。
这是我的构建定义
这是我的构建参数
/target:publish
/p:ApplicationVersion=$(Build.BuildNumber)
/p:PublishURL=http://app-staging.example.com/
/p:UpdateEnabled=true
/p:UpdateMode=Foreground
/p:ProductName="App Staging"
/p:OutputPath="$(build.ArtifactStagingDirectory)\Publish\\"
Run Code Online (Sandbox Code Playgroud)
配置设置为第一次构建的暂存,然后第二次构建的生产。当然,我在 Visual Studio 中有一个Staging和Production构建定义。我有一个app.configwithapp.Staging.config和app.Production.configin 我的项目。
我不能简单地添加一个任务来在构建后转换我的配置文件,因为我不会尊重哈希。我应该找到一种方法来告诉我的构建使用正确的 XML 转换配置文件。我没有看到任何其他解决方案,或者可能在构建之前应用此转换?是否可以?你的解决方案是什么?
我试图在DotNetCoreCLI@2使用build publish命令执行任务时排除项目。我有一些我不想运行发布的测试项目(和其他项目)。我已经尝试根据this和this 进行文件匹配,但我无法开始工作。该projects属性的文档没有确切说明如何编写排除项,我尝试了下面显示的不同变体。
变体 1
projects: '**/*.csproj
!**/*.Test.csproj'
Run Code Online (Sandbox Code Playgroud)
变体 2
projects: '**/*.csproj
!**/*.Test.csproj'
Run Code Online (Sandbox Code Playgroud)
变体 3
projects: '**/*.csproj !**/*.Test.csproj'
Run Code Online (Sandbox Code Playgroud)
但是这三个报告 ##[error]Project file(s) matching the specified pattern were not found.
如果我删除排除项,一切都会按预期进行,但它会构建所有项目的发布。
任何人都对如何编写它有建议吗?
尝试使用 azure 管道进行部署时出现错误。
Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
Run Code Online (Sandbox Code Playgroud)
我认为这是因为 node_modules 文件夹没有在阶段之间共享。但我无法弄清楚什么是正确的方法。
这是我的 yaml 文件:
variables:
- group: netlify
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: Build
jobs:
- job: ARM
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
npm install
npm run unit
displayName: 'Setup and test'
- script: npm run build
- publish: $(System.DefaultWorkingDirectory)
artifact: dist
- stage: Deploy
dependsOn: Build
condition: succeeded()
jobs:
- job: APP
steps:
- bash: | …Run Code Online (Sandbox Code Playgroud) 在DevOps Pipeline 中构建我的 Android 应用程序时,我想从我的 gradle 脚本中访问预定义的Azure DevOps 变量,如下所示:
apply plugin: 'com.android.application'
// When running on the CI, this will return the build-number. Otherwise use 1
def buildNumber = System.getenv("Build.BuildNumber") as Integer ?: 1
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "my.app.id"
minSdkVersion 23
targetSdkVersion 29
versionCode buildNumber
versionName "1.0." + buildNumber
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
...
}
Run Code Online (Sandbox Code Playgroud)
在Bitrise 上,调用def buildNumber = System.getenv("BITRISE_BUILD_NUMBER") as Integer ?: 1工作得很好,但我不知道如何访问Azure DevOps Pipeline 中的Build.BuildNumber …
我在使用Set-Authenticodepowershell 函数作为 Azure DevOps 管道的一部分对.NET Standard 2.0 程序集进行签名时遇到问题。我已经编写了一些 powershell 来完成目录中的汇编并将签名应用于文件夹中的每个 DLL:
$project = "${{ parameters.projects }}"; # todo: what about multi-line values here
$folderPath = [System.IO.Directory]::GetParent($project)
$files = Get-ChildItem -Path $folderPath -Filter "*.dll" -Recurse
$securePassword = ConvertTo-SecureString $(CertificatePassword) -AsPlainText -Force
$certificate = Get-PfxCertificate -FilePath $(CodeSignCertificate.secureFilePath) -NoPromptForPassword -Password $securePassword
foreach($file in $files) {
Write-Host "Setting Authenticode Signature for $file"
$result = Set-AuthenticodeSignature -FilePath $file -Certificate $certificate -Force -HashAlgorithm SHA256 -IncludeChain All -TimestampServer "http://tsa.starfieldtech.com"
if ($result.Status.ToString().Contains("Error")) { Write-Error $result.StatusMessage } …Run Code Online (Sandbox Code Playgroud) powershell authenticode azure-devops azure-pipelines .net-standard
我有以下 Azure Pipelines 作业:
- stage: Production
dependsOn: Test
jobs:
- job: Publish
pool:
vmImage: 'Ubuntu 16.04'
steps:
- task: UseDotNet@2
displayName: Setup
inputs:
packageType: sdk
version: 3.1.x
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
publishWebProjects: false
projects: 'src/**/*.csproj'
arguments: '--configuration production --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: true
- task: PublishPipelineArtifact@0
displayName: Export
inputs:
artifactName: Production
targetPath: '$(Build.ArtifactStagingDirectory)'
- deployment: Deploy
dependsOn: Publish
pool:
vmImage: Ubuntu-16.04
environment: Production
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@1
displayName: Import
inputs:
artifactName: Production
- …Run Code Online (Sandbox Code Playgroud) azure-pipelines ×10
azure-devops ×9
azure ×3
android ×1
authenticode ×1
clickonce ×1
devops ×1
gradle ×1
powershell ×1
string ×1
versioning ×1
yaml ×1