Skip to content

Instantly share code, notes, and snippets.

@alexellis
Created June 21, 2018 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexellis/dfa1b8790ac3d26614e342746c64cbc8 to your computer and use it in GitHub Desktop.
Save alexellis/dfa1b8790ac3d26614e342746c64cbc8 to your computer and use it in GitHub Desktop.
Jenkins cron job to run an OpenFaaS function every minute
pipeline {
agent any
triggers { cron('* * * * *') }
stages {
stage('Invoke') {
steps {
sh "curl -sL https://github.com/openfaas/faas-cli/releases/download/0.6.10/faas-cli > faas-cli"
sh "chmod +x faas-cli"
sh "echo Jenkins! | ./faas-cli invoke --gateway http://192.168.0.35:8080 figlet"
}
}
}
}
@alexellis
Copy link
Author

Started by timer
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/Invoke figlet
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Invoke)
[Pipeline] sh
[Invoke figlet] Running shell script
+ curl -sL https://github.com/openfaas/faas-cli/releases/download/0.6.10/faas-cli
[Pipeline] sh
[Invoke figlet] Running shell script
+ chmod +x faas-cli
[Pipeline] sh
[Invoke figlet] Running shell script
+ echo Jenkins!
+ ./faas-cli invoke --gateway http://192.168.0.35:8080 figlet
     _            _    _           _ 
    | | ___ _ __ | | _(_)_ __  ___| |
 _  | |/ _ \ '_ \| |/ / | '_ \/ __| |
| |_| |  __/ | | |   <| | | | \__ \_|
 \___/ \___|_| |_|_|\_\_|_| |_|___(_)
                                     
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment