File tree Expand file tree Collapse file tree 3 files changed +52
-7
lines changed
vsts-variable-transform/v3 Expand file tree Collapse file tree 3 files changed +52
-7
lines changed Original file line number Diff line number Diff line change 60
60
"options" : {
61
61
"value" : " value" ,
62
62
"env" : " env"
63
- },
64
- "aliases" : [" variableName" ]
63
+ }
65
64
},
66
65
{
67
66
"defaultValue" : " " ,
Original file line number Diff line number Diff line change 34
34
}
35
35
],
36
36
"inputs" : [
37
+ {
38
+ "defaultValue" : " value" ,
39
+ "helpMarkdown" : " Take the value from the input or an environment variable." ,
40
+ "label" : " From" ,
41
+ "name" : " From" ,
42
+ "required" : true ,
43
+ "type" : " pickList" ,
44
+ "options" : {
45
+ "value" : " value" ,
46
+ "env" : " env"
47
+ }
48
+ },
37
49
{
38
50
"defaultValue" : " " ,
39
- "helpMarkdown" : " Input value. You can use other variables as input as with any other text input using the `$(...)` notation anywhere in the value ." ,
40
- "label" : " Input Value" ,
41
- "name" : " value " ,
51
+ "helpMarkdown" : " The value to assign to the variable ." ,
52
+ "label" : " Value" ,
53
+ "name" : " Value " ,
42
54
"required" : false ,
43
- "type" : " string"
55
+ "type" : " string" ,
56
+ "aliases" : [" value" ],
57
+ "visibleRule" : " From=value"
58
+ },
59
+ {
60
+ "defaultValue" : " " ,
61
+ "helpMarkdown" : " The value to assign to the variable." ,
62
+ "label" : " Environment Variable" ,
63
+ "name" : " Env" ,
64
+ "required" : true ,
65
+ "type" : " string" ,
66
+ "aliases" : [" Env" , " Environment" ],
67
+ "visibleRule" : " From=env"
44
68
},
45
69
{
46
70
"defaultValue" : " " ,
Original file line number Diff line number Diff line change 1
1
import * as tl from "azure-pipelines-task-lib/task" ;
2
2
3
3
const transformAction = tl . getInput ( "transformAction" , false ) || "none" ;
4
- let value = tl . getInput ( "value" ) || "" ;
4
+
5
+ function getValue ( )
6
+ {
7
+ const from = tl . getInput ( "From" ) || "value" ;
8
+ switch ( from )
9
+ {
10
+ case "value" :
11
+ {
12
+ return tl . getInput ( "Value" ) ;
13
+ }
14
+ case "env" :
15
+ {
16
+ return process . env [ tl . getInput ( "Env" , true ) ] ;
17
+ }
18
+ default :
19
+ {
20
+ return "" ;
21
+ }
22
+ }
23
+ }
24
+
25
+ let value = getValue ( ) || "" ;
26
+
5
27
const isSecret = tl . getBoolInput ( "isSecret" ) || false ;
6
28
const useTaskLib = tl . getBoolInput ( "useTasklib" ) || false ;
7
29
const variable = tl . getInput ( "variableName" , true ) ;
You can’t perform that action at this time.
0 commit comments