File tree Expand file tree Collapse file tree 2 files changed +47
-2
lines changed Expand file tree Collapse file tree 2 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 50
50
"required" : false ,
51
51
"visibleRule" : " VariableName=release.releasename"
52
52
},
53
+ {
54
+ "defaultValue" : " value" ,
55
+ "helpMarkdown" : " Take the value from the input or an environment variable." ,
56
+ "label" : " From" ,
57
+ "name" : " From" ,
58
+ "required" : true ,
59
+ "type" : " pickList" ,
60
+ "options" : {
61
+ "value" : " value" ,
62
+ "env" : " env"
63
+ },
64
+ "aliases" : [" variableName" ]
65
+ },
53
66
{
54
67
"defaultValue" : " " ,
55
68
"helpMarkdown" : " The value to assign to the variable." ,
56
69
"label" : " Value" ,
57
70
"name" : " Value" ,
58
71
"required" : false ,
59
72
"type" : " string" ,
60
- "aliases" : [" value" ]
73
+ "aliases" : [" value" ],
74
+ "visibleRule" : " From=value"
75
+ },
76
+ {
77
+ "defaultValue" : " " ,
78
+ "helpMarkdown" : " The value to assign to the variable." ,
79
+ "label" : " Environment Variable" ,
80
+ "name" : " Env" ,
81
+ "required" : true ,
82
+ "type" : " string" ,
83
+ "aliases" : [" Env" , " Environment" ],
84
+ "visibleRule" : " From=env"
61
85
},
62
86
{
63
87
"defaultValue" : false ,
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 variable = tl . getInput ( "VariableName" , true ) ;
4
- const 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
+ const value = getValue ( )
5
26
const isSecret = tl . getBoolInput ( "isSecret" ) || false ;
6
27
const useTaskLib = tl . getBoolInput ( "useTasklib" ) || false ;
7
28
const useSetVariableForReleaseName = tl . getBoolInput ( "useSetVariableForReleaseName" ) || false ;
You can’t perform that action at this time.
0 commit comments