samrocketman / jervis

Self service Jenkins job generation using Jenkins Job DSL plugin groovy scripts. Reads .jervis.yml and generates a job in Jenkins.
http://sam.gleske.net/jervis-api/
Apache License 2.0
268 stars 45 forks source link

Support for allow_failures #108

Open samrocketman opened 7 years ago

samrocketman commented 7 years ago

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 commented 7 years ago

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

samrocketman commented 6 years ago

See also: