Advertisement
karthikvee

jenkins-environment-variables-pipeline-script

Aug 31st, 2021
1,579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 0.63 KB | None | 0 0
  1. pipeline {
  2.     agent any
  3.     environment {
  4.         user = 'ben'
  5.         user_id = '512'
  6.         DISABLE_AUTH = 'true'
  7.         DB_ENGINE    = 'sqlite'
  8.     }
  9.     stages {
  10.         stage('print env vars') {
  11.             steps {
  12.                 sh 'printenv | sort'
  13.             }
  14.         }    
  15.         stage('use env vars') {
  16.             steps {
  17.                 echo "Build_Number = ${env.BUILD_NUMBER}"
  18.                 echo "USER = ${env.user}"
  19.                 echo "USER_ID = ${user_id}"
  20.                 echo "Database engine is ${DB_ENGINE}"
  21.                 echo "DISABLE_AUTH is ${DISABLE_AUTH}"
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement