Skip to content

Instantly share code, notes, and snippets.

@rtyler
Created November 7, 2020 23:19
Show Gist options
  • Save rtyler/0f7878bb3116b28e74afaa72dc9fc0b1 to your computer and use it in GitHub Desktop.
Save rtyler/0f7878bb3116b28e74afaa72dc9fc0b1 to your computer and use it in GitHub Desktop.
Exploring syntax for more root verbs in Otto (.groovy just for syntax highlighting)
use stdlib
environment {
}
pipeline {
// Parallel will build all sub-stages concurrently without stopping if one
// fails. Any of the stages failing will halt the pipeline after the parallel
// however
parallel {
stage {
name = 'Build Linux/amd64'
steps {
}
}
stage {
name = 'Build Linux/aarch64'
steps {
}
}
stage {
name = 'Build Windows/amd64'
steps {
}
}
}
stage {
name = 'Staging deploy'
steps {
}
}
// Fan out will terminate sub-stages if any one fails
fanout {
stage {
name = 'API testing'
steps {
}
}
stage {
name = 'Load testing'
steps { }
}
}
// Force a UI or other pause in the pipeline state machine
confirm {
message = 'Safe to deploy production?'
}
stage {
name = 'Production deploy'
steps { }
}
rollback {
// Not sure what the right predicate matching here
on = 'some-event-name'
threshold = 10
steps {
sh 'foo'
}
}
}
use stdlib
pipeline {
// For simple cases, perhaps no need for a stage
steps {
git url: 'https://github.com/rtyler/otto', branch: 'main'
sh 'make build test'
archive 'target/release/otto-*'
}
stage {
name = 'Deploy'
steps {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment