Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env groovy
- pipeline {
- agent any
- triggers {
- // Run this every 5 minutes or so.
- cron('5 * * * *')
- }
- stages {
- // Assumption: Agent any should start this task on the master and we
- // haven't had many issues on this.
- stage('Booting up') {
- steps {
- sh 'hostname'
- sh 'docker -v'
- // Doing this with a script block in Groovy surprisingly turned
- // out to be much harder than it should be.
- //
- // Time in nanoseconds, that's as much precision as we can get.
- sh 'date +%s%N > start.time'
- }
- }
- stage('Container') {
- // Start a container. This needs investigation
- steps {
- sh 'true'
- }
- }
- stage('Slave') {
- // Do something on the slave node. This often fails and we don't
- // completely know why.
- // container('ui'){
- // sh 'hostname'
- // }
- steps {
- sh 'true'
- }
- }
- stage('Zabbix') {
- steps {
- sh 'date +%s%N > end.time'
- sh 'echo $(cat end.time) - $(cacontinueslyt start.time) | bc > total.time'
- // Report the time taken to _mostly_ spawn a slave node to Zabbix.
- sh 'zabbix_send {usual suspects} -k slave.time -o - < total.time'
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment