Skip to main content
removing tautology
Source Link
Bruce Becker
  • 3.7k
  • 4
  • 19
  • 41

This question seems similar to another on StackOverflow, but seems to be a directclose, but not exact duplicate of https://stackoverflow.com/questions/37018509/jenkinsfile-build-log

To quote those :

if you just want to check, that your log contains string myTestString you can just call manager.logContains('.myTestString.')

If you want to get some information from the first matching line you can use manager.getLogMatcher(regexp)

You could use the Groovy flow control to break the build - you just need a step to execute the test, which could be implemented in a shell script for example.:

Following the example on the link :

node {
    stage('CheckLog') {
      steps {
        if (manager.logContains('.*myTestString.*')) {
          error("Build failed because of this and that..")    
        }
      }
    }

This question seems similar to another on StackOverflow, but seems to be a direct duplicate of https://stackoverflow.com/questions/37018509/jenkinsfile-build-log

To quote those :

if you just want to check, that your log contains string myTestString you can just call manager.logContains('.myTestString.')

If you want to get some information from the first matching line you can use manager.getLogMatcher(regexp)

You could use the Groovy flow control to break the build - you just need a step to execute the test, which could be implemented in a shell script for example.

Following the example on the link :

node {
    stage('CheckLog') {
      steps {
        if (manager.logContains('.*myTestString.*')) {
          error("Build failed because of this and that..")    
        }
      }
    }

This question seems similar to another on StackOverflow, but seems to be a close, but not exact duplicate of https://stackoverflow.com/questions/37018509/jenkinsfile-build-log

To quote those :

if you just want to check, that your log contains string myTestString you can just call manager.logContains('.myTestString.')

If you want to get some information from the first matching line you can use manager.getLogMatcher(regexp)

You could use the Groovy flow control to break the build - you just need a step to execute the test:

Following the example on the link :

node {
    stage('CheckLog') {
      steps {
        if (manager.logContains('.*myTestString.*')) {
          error("Build failed because of this and that..")    
        }
      }
    }
Source Link
Bruce Becker
  • 3.7k
  • 4
  • 19
  • 41

This question seems similar to another on StackOverflow, but seems to be a direct duplicate of https://stackoverflow.com/questions/37018509/jenkinsfile-build-log

To quote those :

if you just want to check, that your log contains string myTestString you can just call manager.logContains('.myTestString.')

If you want to get some information from the first matching line you can use manager.getLogMatcher(regexp)

You could use the Groovy flow control to break the build - you just need a step to execute the test, which could be implemented in a shell script for example.

Following the example on the link :

node {
    stage('CheckLog') {
      steps {
        if (manager.logContains('.*myTestString.*')) {
          error("Build failed because of this and that..")    
        }
      }
    }