Development docs
  • Introduction
  • General information
    • Development Ecosystem
    • Documentation
    • Testing
    • Continuous Integration
    • Code Style
    • Paradigms
    • Design Patterns
    • Architecture
    • Refactoring
    • Date Formats
  • Various
    • Technologies and services
      • Travis
      • GitHub
    • Databases
      • Database Kinds
      • Style Guide
      • Joins
    • Web
      • Template View
      • Interactive View
      • Open Graph
      • Twitter Card
    • Parsers
    • Regular Expression
    • File Formats
      • Properties
    • Logging
  • git
    • Configuration files
      • gitignore
      • gitattributes
    • Gitflow
    • Tools
  • Web
    • REST
    • SOAP
  • Architecture
    • SOA
  • Object Oriented Programming
    • Returns
  • Jenkins
    • Pipeline
      • Steps
      • Environment
      • Notifications
      • Scripts
  • Java
    • Environment
      • Development Ecosystem
      • IDE
    • General
    • Interfaces and Generics for a Service
      • Dependencies
      • Type Errors
      • Nested Type Errors
    • Creating New Instances Dynamically
      • Using Classes
      • Using Providers
Powered by GitBook
On this page
  • Defining Scripts
  • Reading Scripts
  • Using Scripts

Was this helpful?

  1. Jenkins
  2. Pipeline

Scripts

Additional scripts can be stored into files and then read by the pipeline.

Defining Scripts

Each file should end returning itself.

/**
* Run unit tests.
*/
def unitTests() {
   sh 'mvn test'
}

return this;

Reading Scripts

stage('Setup') {
   steps {
      script {
         commandRunner = load('./ci/command.groovy')
      }
   }
}

Using Scripts

stage('Unit tests') {
    steps {
        script { commandRunner.unitTests() }
    }
}
PreviousNotificationsNextEnvironment

Last updated 6 years ago

Was this helpful?