我有一个带有预定义变量$(ProjectBuildNumber)的Microsoft Visual Studio Team Foundation Server(版本15.117.26714.0).
有没有办法在构建过程中增加带有次要内部编号+1的变量的值?
$(ProjectBuildNumber) = 663
Run Code Online (Sandbox Code Playgroud)
那么,在下一次构建时,它将是:
$(ProjectBuildNumber) = 664
Run Code Online (Sandbox Code Playgroud)
我有一个 JSON 格式的以下文件:
之前ConvertTo-JSON
:
[
{
"Yura": {
"Cashier": {
"branch": "release/Retail-v4.0",
"configuration": "RetailDemo Debug",
"datetime_deployed": "Apr 18 2018 07:45:05",
"deployed_by": "anonymous",
"host": "cashier2-retail4.testing.aws.com",
"job": "http://jenkins-testing.aws.com:8080/job/CashierDeployment",
"lineserver": "",
"messagebus": "",
"product": "Cashier",
"publish_profile": "cashier2.retail.dev.pubxml"
},
"ContentManager": {
"branch": "release/Retail-v3.31.1",
"configuration": "RetailDemo Debug",
"datetime_deployed": "Jan 17 2018 11:59:24",
"deployed_by": "anonymous",
"host": "contentmanager2-retail3.testing.aws.com",
"job": "http://jenkins-testing.aws.com:8080/job/ContentManagerDeployment",
"lineserver": "",
"messagebus": "",
"product": "ContentManager",
"publish_profile": "..\\ContentManager.PublishProfiles\\contentmanager2.retail5.dev.pubxml"
}
}
}
]
Run Code Online (Sandbox Code Playgroud)
使用此代码操作数据后:
$json = Get-Content 'D:\script\test.json' -encoding utf8 | ConvertFrom-Json
$json.yura.ContentManager.branch = 'test'
Run Code Online (Sandbox Code Playgroud)
我将 …
我有一个 powershell 脚本,我从 Jenkins 那里接收元素名称作为变量:
$IISarray = @("$ENV:Cashier_NAME", "$ENV:Terminal_NAME", "$ENV:Content_Manager_NAME", "$ENV:Kiosk_BO_NAME")
foreach ($string in $IISarray){
"some code goes here"
}
Run Code Online (Sandbox Code Playgroud)
有时随机元素可以为空。如何添加检查以查看数组中的当前元素是否为空,跳过它并转到下一个元素?
我有一个变量,它从 json 返回值:
$version = (Get-Content 'package.json' | ConvertFrom-Json).version
Run Code Online (Sandbox Code Playgroud)
此值始终采用 xxx 格式。它可以是 0.0.3 或 1.123.23 值。
我的问题是 - 如何增加唯一的补丁值?例如,转换后我需要有 0.0.4 或 1.123.24 输出值。
我想实现 LogicApp,每次当有人更改应用程序配置中的键值对时都会触发构建。为了做到这一点,我创建了一个逻辑应用程序,当资源事件发生时触发:
但是,当我在应用程序配置中更改某些内容或手动尝试运行逻辑应用程序时,它会引发错误:
InvalidTemplate
The template language expression evaluation failed: 'The execution of template trigger 'When_a_resource_event_occurs' failed: the result of the evaluation of 'splitOn' expression '@triggerBody()' is of type 'Null'. The result must be a valid array.'.
Run Code Online (Sandbox Code Playgroud)
谁能提示我,逻辑应用程序配置有什么问题吗?
我有一个 PS 脚本,它在变量 ant 中获取 JSON,然后将其保存在文件中。
不幸的是,它在一个字符串中获取值,如下所示:
{ "persistentdataapi": "https://somevalue.azurewebsites.net/", "collectioncountapi": "https://anothervalue.azurewebsites.net/", "eventserviceapi": "https://thirdvalue.azurewebsites.net/", "securityserviceapi": "https://fourthvalue.azurewebsites.net/" }
Run Code Online (Sandbox Code Playgroud)
有没有办法通过某种(最好是 PS)JSON 格式来处理这个值,以获得这个:
{
"persistentdataapi": "https://somevalue.azurewebsites.net/",
"collectioncountapi": "https://anothervalue.azurewebsites.net/",
"eventserviceapi": "https://thirdvalue.azurewebsites.net/",
"securityserviceapi": "https://fourthvalue.azurewebsites.net/",
}
Run Code Online (Sandbox Code Playgroud)
在 Jenkins 中获取价值的代码:
Import-Module "C:\Program Files\WindowsPowerShell\Modules\Octopus-Cmdlets\0.4.4\Octopus-Cmdlets.psd1"
connect-octoserver http://internal-Octopus.azure.com:8082 API-123456789012345678
$raw = (Get-OctoVariable var.Portal.Web DataAPIJson | Where-Object { $_.Environment -eq "QA" } )
$raw.Value | Out-File "$env:WORKSPACE\portal\var.Portal.Web\dataapi.json"
Run Code Online (Sandbox Code Playgroud) 有没有办法在构建任务后只存档选定的文件?我只找到了“归档文件”任务,但它完全归档了整个文件夹。
我有一个包含以下内容的txt文件:
testdemo | 5 | 4563456| OMNI | retailomni
testRetail | 142 | 3453456345| testRetai111l | test
testtesttest | 44 | 4564356| apl | APL
Run Code Online (Sandbox Code Playgroud)
我需要选择从“testdemo”开始的整个字符串。这怎么能在PS中完成?
$operator = "testdemo"
$operatorcontent = Get-Content operators.txt | "Need to get whole string, starts from $operator"
Run Code Online (Sandbox Code Playgroud) powershell ×5
json ×3
azure-devops ×2
azure ×1
formatting ×1
jenkins ×1
key-value ×1
pretty-print ×1
tfs ×1
version ×1