diff --git a/vsts-variable-set/v3/task.json b/vsts-variable-set/v3/task.json index 9bae2c3..a99f5bb 100644 --- a/vsts-variable-set/v3/task.json +++ b/vsts-variable-set/v3/task.json @@ -60,8 +60,7 @@ "options": { "value": "value", "env": "env" - }, - "aliases": ["variableName"] + } }, { "defaultValue": "", diff --git a/vsts-variable-transform/v3/task.json b/vsts-variable-transform/v3/task.json index de97e07..11ce775 100644 --- a/vsts-variable-transform/v3/task.json +++ b/vsts-variable-transform/v3/task.json @@ -34,13 +34,37 @@ } ], "inputs": [ + { + "defaultValue": "value", + "helpMarkdown": "Take the value from the input or an environment variable.", + "label": "From", + "name": "From", + "required": true, + "type": "pickList", + "options": { + "value": "value", + "env": "env" + } + }, { "defaultValue": "", - "helpMarkdown": "Input value. You can use other variables as input as with any other text input using the `$(...)` notation anywhere in the value.", - "label": "Input Value", - "name": "value", + "helpMarkdown": "The value to assign to the variable.", + "label": "Value", + "name": "Value", "required": false, - "type": "string" + "type": "string", + "aliases": ["value"], + "visibleRule": "From=value" + }, + { + "defaultValue": "", + "helpMarkdown": "The value to assign to the variable.", + "label": "Environment Variable", + "name": "Env", + "required": true, + "type": "string", + "aliases": ["Env", "Environment"], + "visibleRule": "From=env" }, { "defaultValue": "", diff --git a/vsts-variable-transform/v3/vsts-variable-transform.ts b/vsts-variable-transform/v3/vsts-variable-transform.ts index fbdb7cd..14a3ece 100644 --- a/vsts-variable-transform/v3/vsts-variable-transform.ts +++ b/vsts-variable-transform/v3/vsts-variable-transform.ts @@ -1,7 +1,29 @@ import * as tl from "azure-pipelines-task-lib/task"; const transformAction = tl.getInput("transformAction", false) || "none"; -let value = tl.getInput("value") || ""; + +function getValue() +{ + const from = tl.getInput("From") || "value"; + switch (from) + { + case "value": + { + return tl.getInput("Value"); + } + case "env": + { + return process.env[tl.getInput("Env", true)]; + } + default: + { + return ""; + } + } +} + +let value = getValue() || ""; + const isSecret = tl.getBoolInput("isSecret") || false; const useTaskLib = tl.getBoolInput("useTasklib") || false; const variable = tl.getInput("variableName", true);