content_image/700827.jpg
// 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. 

## options 

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 . 

<img src='content_image/700827.jpg'>

## Available Options 

## buildDiscarder 

Persist artifacts and console output for the specific number of recent Pipeline runs. For example: options { buildDiscarder(logRotator(numToKeepStr: '1')) } 

## disableConcurrentBuilds 

Disallow concurrent executions of the Pipeline. Can be useful for preventing simultaneous 

