jervis icon indicating copy to clipboard operation
jervis copied to clipboard

Support for allow_failures

Open samrocketman opened this issue 8 years ago • 2 comments

Adding support for allow_failures seems relatively straight forward.

Sample YAML

language: groovy
env:
  - GROOVY_VERSION="1.8.9"
  - GROOVY_VERSION="2.4.12"
  - GROOVY_VERSION="2.5.0-beta-1"
  - GROOVY_VERSION="2.6.0-alpha-1"
matrix:
  allow_failures:
    - env: GROOVY_VERSION="2.6.0-alpha-1"

Groovy implementation

lifecycleGenerator should have a method to determine if an axis is allowed to fail. The try/catch shell step should be in a separate pipeline step.

def t = [a: 'hello2', b: 'world']
def x = [a: 'hello', b: 'world', c: 'mars']

t == t.intersect(x)

If allow_failures key is t and x is a matrix axis. allow_failures is typically a List so for more completeness.

true in allow_failures.collect { t ->
  t == t.intersect(x)
}

Which will wrap the shell step in a try/catch and set the build as unstable if a failure is allowed rather than marking it as failed.

samrocketman avatar Oct 28 '17 22:10 samrocketman

Possible now that Jervis is migrating to pipelines. Formerly attempted in #7 which didn't yield much success for support of this feature.

samrocketman avatar Oct 28 '17 22:10 samrocketman

See also:

  • https://issues.jenkins-ci.org/browse/JENKINS-38793 shows all following stages as failed.
  • https://support.cloudbees.com/hc/en-us/articles/218554077-How-to-set-current-build-result-in-Pipeline-
  • https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#code-catcherror-code-catch-error-and-set-build-result catchError step
  • https://issues.jenkins-ci.org/browse/JENKINS-39203 all stages show up as unstable

samrocketman avatar Apr 05 '18 07:04 samrocketman