使用Powershell更改构建变量不起作用

时间:2019-01-17 14:42:23

标签: powershell tfs tfsbuild

我想在构建时更改tfs变量BUILD_SOURCEBRANCHNAME,在构建步骤中使用以下Powershell脚本:

##vso[build.sourcebranch]master

这不会引发错误,但也不起作用吗?

我该如何实现?

1 个答案:

答案 0 :(得分:2)

更改Azure DevOps中任何环境变量的语法为:

import cv2
import numpy as np

model = cv2.dnn.readNetFromTorch('./cyclegan_horse2zebra_cpu.t7')

image = cv2.imread('./images/1.jpg')

blob = cv2.dnn.blobFromImage(image, 1, (256, 256))
model.setInput(blob)

out = model.forward()[0,:,:,:]
out = np.reshape(out, (256, 256, 3))

cv2.imshow('image', out)
cv2.waitKey(0)

cv2.imwrite('out.png', out)

因此,在您的情况下,如果要“伪造”源分支:

Write-Host "##vso[task.setvariable variable=someVar]varValue"

之前的变量:

enter image description here

脚本:

enter image description here

之后的变量:

enter image description here