Skip to content

Instantly share code, notes, and snippets.

@zhouqiang-cl
Last active January 28, 2019 17:04
Show Gist options
  • Save zhouqiang-cl/90c5fa160a763a447c101e3c43918e14 to your computer and use it in GitHub Desktop.
Save zhouqiang-cl/90c5fa160a763a447c101e3c43918e14 to your computer and use it in GitHub Desktop.
// manager hold status
// groovy hold stage
def cfg = [:]
cfg["type"] = "tidb-cluster"
cfg["size"] = {"tikv":{"size":3,"version":"111"},"tidb":{"size":1,"version":"x"},"pd":{"size":1,"version":"x"}}
def cat = new Cat(cfg) // Cat is an function, type specify what kind of cat should be start
def monitor = new Monitor() // when script is quit, monitor will quit
def reportor = new Reportor("oncall-sre") // if it create repotor, then default reportor will not report
stage("prepare") {
cat.Start() // Start will start cat and fill cat field
monitor.add_item(cat)
reportor.add_item(cat)
}
ddl = new Ddl(cat.service_ip, params1)
ddl_pod = new Pod(ddl)
upgrade = new Upgrade(cat, params2)
upgrade_pod = new Pod(upgrade)
stage("running") {
timeout(30) {
ddl_pod.Start()
monitor.add_item(ddl_pod)
reportor.add_item(ddl_pod)
upgrade_pod.Start()
monitor.add_item(upgrade_pod)
reportor.add_item(upgrade_pod)
}
}
stage("finish") {
reportor.Report()
pod.Destory()
cat.Destory()
}
status("failed") {
reportor.Report()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment