Still a problem with Jenkins 2.204.2, Pipeline 2.6. This is a bit of a deal breaker at the moment. I am using a matrix build with declarative pipeline like so:
pipeline { agent any stages { stage('Build') { matrix { agent { dockerfile true } axes { axis { name 'AREA' values 'dev', 'test', 'prod' } } stages { stage('Build') { steps { sh "AREA=${AREA}" sh 'mvn clean install package' } } } post { always{ archiveArtifacts artifacts: '**/target/rpm/**/*.rpm' } } } } } }