File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -254,3 +254,17 @@ func (i *iteratorRole) GetUserVars() gera.StringMap {
254254 }
255255 return i .template .GetUserVars ()
256256}
257+
258+ func (i * iteratorRole ) SetRuntimeVar (key string , value string ) {
259+ if i == nil {
260+ return
261+ }
262+ i .template .SetRuntimeVar (key , value )
263+ }
264+
265+ func (i * iteratorRole ) SetRuntimeVars (kv map [string ]string ) {
266+ if i == nil {
267+ return
268+ }
269+ i .template .SetRuntimeVars (kv )
270+ }
Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ type Role interface {
5555 setParent (role Updatable )
5656 ProcessTemplates (workflowRepo * repos.Repo ) error
5757 GlobFilter (g glob.Glob ) []Role
58+ SetRuntimeVar (key string , value string )
59+ SetRuntimeVars (kv map [string ]string )
5860}
5961
6062type Updatable interface {
Original file line number Diff line number Diff line change @@ -62,6 +62,16 @@ type roleBase struct {
6262 Locals map [string ]string `yaml:"-"` // only used for passing iterator from template to new role
6363}
6464
65+ func (r * roleBase ) SetRuntimeVar (key string , value string ) {
66+ r .UserVars .Set (key , value )
67+ }
68+
69+ func (r * roleBase ) SetRuntimeVars (kv map [string ]string ) {
70+ for k , v := range kv {
71+ r .UserVars .Set (k , v )
72+ }
73+ }
74+
6575func (r * roleBase ) ConsolidatedVarStack () (varStack map [string ]string , err error ) {
6676 // This function is used in task.go to get the parent role's varStack
6777 var defaults , vars , userVars map [string ]string
You can’t perform that action at this time.
0 commit comments