在用 Typescript 编写的任务中阅读 TFS/VSTS 秘密变量
Read TFS/VSTS Secreat Variables in Task written in Typescript
我需要读取 typescript
中预定义变量下定义的密码值
我正在使用以下符号读取纯文本变量。
import tl = require('vsts-task-lib/task');
var password = tl.getVariable("amiprotacted");
我需要知道读取秘密变量的方法。以及是否有分离明文和秘密值的方法?请好心人指点一下。
我目前指的是 https://www.visualstudio.com/en-us/docs/build/define/variables#secret-variables 关于秘密变量的文章(但是没有可用的示例来使用 Typescript 执行此操作)
代码中无法读取秘密变量,需要通过task的输入框传入。所以你可以添加一个输入让用户传递秘密变量并使用 getInput/getPathInput 等获取值... VSTS-TASK-LIB TYPESCRIPT API
Secret variables are:
• Encrypted at rest with a 2048-bit RSA key.
• Not returned back to the client. They are automatically masked out
of any log output from the build or release.
• Not decrypted into environment variables. So scripts and programs
run by your build steps are not given access by default.
• Decrypted for access by your build steps. So you can use them in
password arguments (for example Build and Deploy your Java application
to an Azure web app and also pass them explicitly into a script or a
program from your build step (for example as $(password)).
我需要读取 typescript
中预定义变量下定义的密码值我正在使用以下符号读取纯文本变量。
import tl = require('vsts-task-lib/task');
var password = tl.getVariable("amiprotacted");
我需要知道读取秘密变量的方法。以及是否有分离明文和秘密值的方法?请好心人指点一下。
我目前指的是 https://www.visualstudio.com/en-us/docs/build/define/variables#secret-variables 关于秘密变量的文章(但是没有可用的示例来使用 Typescript 执行此操作)
代码中无法读取秘密变量,需要通过task的输入框传入。所以你可以添加一个输入让用户传递秘密变量并使用 getInput/getPathInput 等获取值... VSTS-TASK-LIB TYPESCRIPT API
Secret variables are:
• Encrypted at rest with a 2048-bit RSA key.
• Not returned back to the client. They are automatically masked out of any log output from the build or release.
• Not decrypted into environment variables. So scripts and programs run by your build steps are not given access by default.
• Decrypted for access by your build steps. So you can use them in password arguments (for example Build and Deploy your Java application to an Azure web app and also pass them explicitly into a script or a program from your build step (for example as $(password)).