Guest User

Untitled

a guest
Jan 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. #!/usr/bin/env groovy
  2.  
  3. pipeline {
  4. agent any
  5.  
  6. triggers {
  7. // Run this every 5 minutes or so.
  8. cron('5 * * * *')
  9. }
  10.  
  11. stages {
  12. // Assumption: Agent any should start this task on the master and we
  13. // haven't had many issues on this.
  14.  
  15. stage('Booting up') {
  16. steps {
  17. sh 'hostname'
  18. sh 'docker -v'
  19.  
  20. // Doing this with a script block in Groovy surprisingly turned
  21. // out to be much harder than it should be.
  22. //
  23. // Time in nanoseconds, that's as much precision as we can get.
  24. sh 'date +%s%N > start.time'
  25. }
  26. }
  27.  
  28. stage('Container') {
  29. // Start a container. This needs investigation
  30. steps {
  31. sh 'true'
  32. }
  33. }
  34.  
  35. stage('Slave') {
  36. // Do something on the slave node. This often fails and we don't
  37. // completely know why.
  38.  
  39. // container('ui'){
  40. // sh 'hostname'
  41. // }
  42.  
  43. steps {
  44. sh 'true'
  45. }
  46. }
  47.  
  48. stage('Zabbix') {
  49. steps {
  50. sh 'date +%s%N > end.time'
  51. sh 'echo $(cat end.time) - $(cacontinueslyt start.time) | bc > total.time'
  52.  
  53. // Report the time taken to _mostly_ spawn a slave node to Zabbix.
  54. sh 'zabbix_send {usual suspects} -k slave.time -o - < total.time'
  55. }
  56. }
  57. }
  58. }
Add Comment
Please, Sign In to add comment