Use withEnvVars to set environment variables.

Change-Id: I65042767ac3d2cde846ce39a78e30e8a866d1463
diff --git a/cicd/pipelines/enterprise/image_unstable.jenkins b/cicd/pipelines/enterprise/image_unstable.jenkins
index 3079258..1940fc4 100644
--- a/cicd/pipelines/enterprise/image_unstable.jenkins
+++ b/cicd/pipelines/enterprise/image_unstable.jenkins
@@ -16,36 +16,39 @@
                                         ttyEnabled: true,
                                         privileged: true)
 def aptlyVolume = persistentVolumeClaim(claimName: 'aptly-state', mountPath: '/var/lib/aptly')
-def envVars = [
-    'IS_JENKINS': 'true',
-    'RELEASE_NAME': 'unstable'
-]
 
 podTemplate(label: buildLabel, containers: [jnlpContainer, debianContainer], volumes: [aptlyVolume], envVars: envVars) {
     node(buildLabel) {
         dir(sourcePath) {
             container('debian') {
-                stage('Init') {
-                    functions.initSourceTree(boardName, false /* needsNative */)
-                }
+                def envVars = [
+                    'IS_JENKINS=true',
+                    'RELEASE_NAME=unstable'
+                ]
 
-                stage('Build') {
-                    def nprocs = sh(returnStdout: true, script: 'nproc').trim()
-                    sh "bash -c 'source build/setup.sh; m -j${nprocs} prereqs dist; exit \$?'"
-                }
-
-                stage('Deploy') {
-                    def imagePath = "/var/lib/aptly/images/enterprise/unstable"
-                    def files = findFiles(glob: "out/**/dist/*")
-
-                    if (files.size() == 0) {
-                        error 'No dist files generated. Assuming failed build.'
+                withEnv(envVars) {
+                    stage('Init') {
+                        functions.initSourceTree(boardName, false /* needsNative */)
                     }
 
-                    sh "mkdir -p ${imagePath}"
+                    stage('Build') {
+                        def nprocs = sh(returnStdout: true, script: 'nproc').trim()
+                        sh "bash -c 'source build/setup.sh; m -j${nprocs} prereqs dist; exit \$?'"
+                    }
 
-                    for (file in files) {
-                        sh "cp ${file} ${imagePath}"
+                    stage('Deploy') {
+                        def imagePath = "/var/lib/aptly/images/enterprise/unstable"
+                        def files = findFiles(glob: "out/**/dist/*")
+
+                        if (files.size() == 0) {
+                            error 'No dist files generated. Assuming failed build.'
+                        }
+
+                        sh "mkdir -p ${imagePath}"
+
+                        for (file in files) {
+                            sh "cp ${file} ${imagePath}"
+                        }
                     }
                 }
             }