// Declarative // pipeline { agent any environment {  ① CC = 'clang' } stages { stage('Example') { environment {  ② AN_ACCESS_KEY = credentials('my-prefined-secret-text')  ③ } steps { sh 'printenv' } } } } // Script // ① An  environment  directive used in the top-level  pipeline  block will apply to all steps within the Pipeline. ② An  environment  directive defined within a  stage  will only apply the given environment variables to steps within the  stage . ③ The  environment  block has a helper method  credentials()  defined which can be used to access pre-defined Credentials by their identifier in the Jenkins environment. The  options  directive allows configuring Pipeline-specific options from within the Pipeline itself. Pipeline provides a number of these options, such as  buildDiscarder , but they may also be provided by plugins, such as  timestamps . Persist artifacts and console output for the specific number of recent Pipeline runs. For example: options { buildDiscarder(logRotator(numToKeepStr: '1')) } Disallow concurrent executions of the Pipeline. Can be useful for preventing simultaneous disableConcurrentBuilds buildDiscarder Available Options options Require d No Parame ters None Allowed Only once, inside the  pipeline  block. 89