我正在尝试根据我发布到的每个环境在我的 Web.config 上进行文件转换。大多数情况下,在我部署到发布管道上的 UAT 阶段之前,一切看起来都很好。
在我的构建管道中,这是我正在使用的 YAML 文件:
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
pool:
vmImage: 'windows-latest'
variables:
solution: 'SubmissionService.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
displayName: 'Install Newer Version on NuGet'
inputs:
checkLatest: true
- task: NuGetCommand@2
displayName: 'Restore NuGet Packages for Solution'
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: config
nugetConfigPath: ./Nuget.config
- task: VSBuild@1
displayName: 'Create Artifact For Solution' …Run Code Online (Sandbox Code Playgroud) azure-pipelines-build-task azure-pipelines azure-pipelines-release-pipeline azure-pipelines-release-task azure-pipelines-tasks
大图:我们正在使用Azure DevOps发布过程(到目前为止,我们在设计器中创建步骤,而不是在YAML管道中创建步骤)。我们发布到具有3个不同数据库的3个环境。该发行版的一部分是从DACPAC文件部署数据库。由于使用SqlPackage.exe直接发布到数据库不是很透明(您不会看到并查看实际的SQL脚本),因此我们希望分两个阶段进行发布:
问题:如何在阶段之间共享sql脚本文件,以及如何查看该脚本以进行批准。可以在不同的代理上触发阶段。
我已经试过:
还有其他建议吗?
我已经在TFS / AzureDevops构建定义中定义了一个变量(例如time),并在构建定义中使用PowerShell任务分配了值。
喜欢,
类型:内联脚本。
内联脚本:
$date=$(Get-Date -Format g);
Write-Host "##vso[task.setvariable variable=time]$date"
Run Code Online (Sandbox Code Playgroud)
你可以参考这个类似的例子
现在,我想在发布定义管道中获取此值。我将此构建定义配置为对发布定义的持续部署。
如何time使用其他变量在发布定义中获取值?这可能吗?
tfs azure-devops azure-pipelines-build-task azure-pipelines azure-pipelines-release-task
要在 IIS 下创建一个目录并将 Web 应用程序添加到 IIS,我将此脚本放在 Azure DevOps 服务器部署组作业 Powershell 任务中:
New-Item -Path "C:\inetpub\wwwroot" -Name "MyNewApp" -ItemType "directory" `
C:\Windows\system32\inetsrv\appcmd.exe add app `
/site.name:"Default Web Site" `
/path:"/MyNewApp" `
/physicalPath:"C:\inetpub\wwwroot\MyNewApp"`
Run Code Online (Sandbox Code Playgroud)
当此任务运行时,它会抛出一个错误:(为清楚起见,删除了时间戳)
APP 对象“默认网站/MyNewApp”已更改
错误 ( hresult:80090016, 消息: 无法提交配置更改。
密钥集不存在)
在以我自己或服务帐户登录时从 Powershell 控制台执行上述代码后,将返回以下消息:
添加了 APP 对象“默认网站/MyNewApp”
添加了 VDIR 对象“默认网站/MyNewApp”
我可以在 IIS 管理器中确认目录和应用程序已创建。
我无法在控制台中重现该错误。只有当它作为 Release Agent 运行并通过 DevOps Server Web 界面启动时才会发生此错误。
我尝试了以下方法:
更新 1:
我确定“密钥集不存在”错误来自尝试使用 DefaultAppPool 应用程序池作为设置的一部分。此应用程序池未使用服务帐户设置,但仍设置为默认应用程序池标识。
但是,在进行此更改后,我遇到了一个新错误:
APP …
powershell iis-8.5 azure-pipelines-release-task azure-devops-server-2019
我正在使用替换令牌扩展https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens来替换 **/*.config 文件中的变量
我们的构建管道创建了一个需要部署到所有环境的工件
我们的发布管道中有 2 个环境(DEV,QA)
每个环境都配置了一组变量
我已将替换令牌任务添加到我们的发布管道中
我的配置文件看起来像这样
令牌不会被替换,我是 Azure DevOps 的新手,我在这里遗漏了什么吗?
azure-devops azure-pipelines azure-pipelines-release-pipeline azure-pipelines-release-task
我正在尝试在我的代理池中分配一个特定的代理,但我不知道该怎么做。有人知道吗?
我试过这个但不起作用:
- stage: Deploy
pool: alm-aws-pool
agent.name: deploy-05-agent1
Run Code Online (Sandbox Code Playgroud) azure azure-devops azure-pipelines azure-pipelines-release-task azure-pipelines-yaml
我正在为Azure Devops开发一个自定义扩展,它已经包含一个服务端点:
"type": "ms.vss-endpoint.service-endpoint-type"
Run Code Online (Sandbox Code Playgroud)
另外,我想创建一个自定义的Release Artifact Source:
“type”: “ms.vss-releaseartifact.release-artifact-type”
Run Code Online (Sandbox Code Playgroud)
根据此文档,我目前的努力是使用外部API填充工件源下的字段.我在下面的'resultSelector'和'resultTemplate'中尝试了很多模式,但无法找到适合我的模式.
在我的示例中,我想在json响应中的'builds'下获取所有'uri'值,并将它们呈现在Artifact Source的'definition'inputDescriptor中.我的所有尝试都导致了一个空的组合框,即使我可以看到请求达到所需的API.
json我想解析到组合框:
{
"builds": [
{
"uri": "/build1",
"lastStarted": "2018-11-07T13:12:42.547+0000"
},
{
"uri": "/build2",
"lastStarted": "2018-11-09T15:40:30.315+0000"
},
{
"uri": "/build3",
"lastStarted": "2018-11-12T17:46:24.805+0000"
}
],
"uri": "https://<server-address>/api/build"
}
Run Code Online (Sandbox Code Playgroud)
你能帮我创建一个Mustache模式来检索上面的"uri"值吗?
我试过了:
$.builds[*].uri
Run Code Online (Sandbox Code Playgroud)
这似乎不起作用.
以下是一些有用的信息.
服务端点的数据源:
"dataSources": [
{
"name": "TestConnection",
"endpointUrl": "{{endpoint.url}}/api/plugins",
"resourceUrl": "",
"resultSelector": "jsonpath:$.values[*]",
"headers": [],
"authenticationScheme": null
},
{
"name": "BuildNames",
"endpointUrl": "{{endpoint.url}}/api/build",
"resultSelector": "jsonpath:$.builds[*].uri"
},
{
"name": "BuildNumbers",
"endpointUrl": "{{endpoint.url}}/api/builds/{{definition}}",
"resultSelector": "jsonpath:$.buildsNumbers[*].uri"
}
]
Run Code Online (Sandbox Code Playgroud)
神器来源: …
mustache azure-devops azure-pipelines-release-pipeline azure-pipelines-release-task
您之前是否遇到过主题行中提到的错误?,我对此很感兴趣,但无法解决。以下是我为创建服务主体而执行的步骤
az login
-- Gives me a device code to enter in browser
Login to az non-interactively
az account set --subscription="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Check correct account by
az account show
Create a SP
az ad sp create-for-rbac -n "tf-authenticator" --role contributor
Run Code Online (Sandbox Code Playgroud)
运行 terraform 计划,如下所示:
[jim@rhel75 msdn]$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
azurerm_resource_group.tf-rg-cluster-sql: Refreshing state... os_profile_windows_config.1060902566.enable_automatic_upgrades: "true"
Plan: …Run Code Online (Sandbox Code Playgroud) azure-devops terraform-provider-azure azure-pipelines-release-task
我有以下烦人的问题。我的自定义 VSTS 构建任务不会失败。它总是通过,而 $LASTEXITCODE 不为零。
代码按预期执行。它在日志中生成错误。尽管如此,该步骤仍然成功并且构建/发布继续。
截屏:
我还包含了一个带有退出代码的写入主机,它也显示退出代码 1。
代码:
Try {
....
#Loop through the server list
Foreach ($Server in $machines)
{
# Use SSL or not
If($UseSSL -eq $true)
{
Write-Host "Connecting to $Server using a SSL connection (TCP/5986), Skip CA Check: $CheckCA ..."
$s = New-PSSession -ComputerName $Server -Credential $Cred -UseSSL -SessionOption $SessionOptions
}
Else
{
Write-Host "Connecting to $Server with an unsecure connection (TCP/5985) ..."
$s = New-PSSession -ComputerName $Server -Credential $Cred
}
# Run
$ExitCode …Run Code Online (Sandbox Code Playgroud) tfs azure-devops azure-pipelines-build-task azure-pipelines-release-task
我们有一个发布管道,每次构建完成时都会自动创建一个新版本。
那时,我们有了一个候选版本,所以这是有道理的。每个构建都可能是可发布的。
在管道中,发布会自动进入开发阶段。因此,我们进行签入和构建,然后将其发送到开发服务器。
发布到阶段有一个批准门。批准通常需要一段时间,等待批准期间将继续开发。
现在,我们有 10 - 15 个构建被列为排队。
因此,我需要自动取消每一个,以便开始发布最新版本。
当较新的版本进入队列时,有没有办法自动取消发布,或者我应该在开发阶段创建一个后批准,使其保持在阶段之外,直到有人在该发布版本上点击“开始”?
我用这个对吗?
azure-devops azure-pipelines azure-pipelines-release-pipeline azure-pipelines-release-task
我有一个跨越多个部署组的复杂版本,我计划使用 3rd 方vsts-git-release-tag扩展来标记版本。理想情况下,在标记存储库之前,整个发布(所有作业)将首先成功。
因此,我正在努力找出实现这一目标的最佳方法。如果这是一个构建管道而不是部署管道,很明显我可以使用 来dependsOn安排它们,如下所示。
jobs:
- job: Deployment_Group_1
steps:
- script: echo hello from Deployment Group 1
- job: Deployment_Group_2
steps:
- script: echo hello from Deployment Group 2
- job: Tag_Repo
steps:
- script: echo this is where I would tag the Repo
dependsOn:
- Deployment_Group_1
- Deployment_Group_2
Run Code Online (Sandbox Code Playgroud)
但是,本文档中指定的发布管道中似乎没有等效的功能(至少目前是这样)。
笔记
目前仅在构建管道中支持并行运行多个作业。发布管道中尚不支持它。
虽然它没有具体提到该dependsOn功能,但似乎没有办法在发布管道中使用它(如果我错了,请纠正我)。
我意识到我可能会创建一个包含单个作业和任务的单独阶段来创建 Git 标签,但这感觉就像一个黑客。在所有其他发布作业完成后,是否有更好的方法来运行特定的发布作业?
azure azure-devops azure-pipelines azure-pipelines-release-task
我试图在最新版本失败时在发布管道中回滚,它将恢复到最后成功的状态。我添加了一个 PowerShell 任务,该任务仅在以前的任务失败时运行,并且脚本上次成功触发,但问题是它开始随机而不是按顺序重新部署阶段。## 标题 ##
在我的场景中,我有 3 个阶段,在每个阶段结束时,我添加了一个 PowerShell 任务,该任务仅在前一个任务失败时才会触发,并相应地编写了一个脚本来触发最后一次成功发布。所以它将触发上一个版本中的所有阶段,因为我没有任何 API 或命令来通过 id 触发版本。我有一个仅触发阶段的 API。所有阶段都按顺序排队但随机运行。 在此输入图像描述
powershell azure azure-devops azure-pipelines-release-pipeline azure-pipelines-release-task
我创建了一个有效的Azure管道来构建我的代码库。
寻找一种通过API(最好是REST)触发Azure Pipelines构建的方法。如果无法使用REST,也许我可以尝试使用各种资源ID通过Azure Functions调用构建。我希望自己的存储库监视器发出一个API请求,该请求将在满足我的条件时触发构建。另一个问题-是否可以通过API设置“管道变量”-例如,我进行API调用,将值用作管道变量的值,然后触发构建。
谢谢
azure azure-devops azure-pipelines azure-pipelines-release-task
azure-pipelines-release-task ×13
azure-devops ×11
azure-pipelines-release-pipeline ×5
azure ×4
powershell ×2
tfs ×2
iis-8.5 ×1
mustache ×1