For an internal status logging in my jenkins pipeline I have created a "template map which I want do use in multiple stages which are running independently in parallel

```
def status= [
    a : '',
    b: [
            b1: '',
            b2: '',
            b3: ''
      ],
    c: [ 
        c1: '',
        c2 : ''
    ]
]

```

this status template I want to pass to multiple parallel running functions/executors. Inside the parallel branches I want to modify the status independently. See the following minimal example

```
def status= [
    a : '',
    b: [
        b1: '',
        b2: '',
        b3: ''
    ],
    c: [
        c1: '',
        c2 : ''
    ]
]

def label1 = "windows"
def label2 = ''

parallel firstBranch: {
        run_node(label1, status)
    }, secondBranch: {
        run_node(label2, status)
    },
    failFast: true|false

def run_node (label, status){
    node(label) {
        status.b.b1 = env.NODE_NAME +"_"+ env.EXECUTOR_NUMBER
        sleep(1)
        echo "env.NODE_NAME_env.EXECUTOR_NUMBER: ${status.b.b1}"  
        // expected: env.NODE_NAME_env.EXECUTOR_NUMBER
        this.a_function(status)
        echo "env.NODE_NAME_env.EXECUTOR_NUMBER: ${status.b.b1}"  
        // expected(still): env.NODE_NAME_env.EXECUTOR_NUMBER (off current node)
        // is: env.NODE_NAME_env.EXECUTOR_NUMBERmore Info AND probably from the wrong node
    }
}

def a_function(status){
     status.b.b1 += "more Info"
     echo "env.NODE_NAME_env.EXECUTOR_NUMBERmore Info: ${status.b.b1}" 
     // expected: env.NODE_NAME_env.EXECUTOR_NUMBERmore Info
     sleep(0.5)
     echo "env.NODE_NAME_env.EXECUTOR_NUMBERmore Info: ${status.b.b1}" 
     // expected: env.NODE_NAME_env.EXECUTOR_NUMBERmore Info
}

```

Which results in 

> 
> [firstBranch] env.NODE\_NAME\_env.EXECUTOR\_NUMBER:
>  LR-Z4933-39110bdb\_0
> 
> 
> [firstBranch] env.NODE\_NAME\_env.EXECUTOR\_NUMBERmore Info:
>  LR-Z4933-39110bdb\_0more Info
> 
> 
> [firstBranch] env.NODE\_NAME\_env.EXECUTOR\_NUMBER>more Info:
>  LR-Z4933-39110bdb\_0more Info
> 
> 
> [firstBranch] env.NODE\_NAME\_env.EXECUTOR\_NUMBER:
>  LR-Z4933-39110bdb\_0more Info
> 
> 
> [secondBranch] env.NODE\_NAME\_env.EXECUTOR\_NUMBER:
>  LR-Z4933-39110bdb\_0more Info
> 
> 
> [secondBranch] env.NODE\_NAME\_env.EXECUTOR\_NUMBERmore Info:
>  LR-Z4933-39110bdb\_0more Infomore Info
> 
> 
> [secondBranch] env.NODE\_NAME\_env.EXECUTOR\_NUMBERmore Info:
>  LR-Z4933-39110bdb\_0more Infomore Info
> 
> 
> [secondBranch] env.NODE\_NAME\_env.EXECUTOR\_NUMBER:
>  LR-Z4933-39110bdb\_0more Infomore Info
> 
> 
> 

Note that in the status in the first branch is overwritten by the second branch and the other way around.

How to realize independent status variables when passing thm as a parameter to functions