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
  • Conditional Step
  • Retry
  • After Step
  • After All the Steps

Was this helpful?

  1. Jenkins
  2. Pipeline

Steps

Conditional Step

stage('Integration tests') {
   when {
      expression { flowControl.runIntegrationTests() }
   }
   steps {
      script { commandRunner.integrationTests() }
   }
}

Retry

stage('Deploy repository'){
   steps {
      script {
         timeout(time: 30, unit: 'MINUTES') {
            retry(1) {
               deployer.deployToRepo();
            }
         }
      }
   }
}

After Step

In this case a message is stored in an environmental variable, and then it always publishes the coverage results.

stage('Integration tests') {
   steps {
      script { commandRunner.integrationTests() }
   }
   post {
      failure {
         script { env.ERROR_MESSAGE = 'Integration tests failed' }
      }
      always {
         script { commandRunner.publishCoverage() }
      }
   }
}

After All the Steps

post {
    failure {
        script { notifier.notifyFailure(currentBuild) }
    }
    changed {
        script { notifier.notifyChange(currentBuild) }
    }
}
PreviousPipelineNextEnvironment

Last updated 6 years ago

Was this helpful?