Created
August 4, 2016 06:18
-
-
Save frekele/d1bc5ca04b1b1f2f78a60bbc2e7f6cf1 to your computer and use it in GitHub Desktop.
Jenkinsfile pipelineTriggers - TimerTrigger periodic run the aws-update-my-dynamic-ip.sh script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!groovy | |
MAIL_FROM = '[email protected]' | |
MAIL_TO = '[email protected]' | |
GITHUB_PROTOCOL = 'https' | |
GITHUB_USER_NAME = 'my-github-user' | |
GITHUB_USER_EMAIL = '[email protected]' | |
GITHUB_REPO = 'github.com/my-user/my-repository' | |
GITHUB_PROJECT_URL = "${GITHUB_PROTOCOL}://${GITHUB_REPO}" | |
node { | |
try { | |
properties( | |
[ | |
[ | |
$class : 'jenkins.model.BuildDiscarderProperty', | |
strategy: [ | |
$class : 'LogRotator', | |
numToKeepStr: '200' | |
] | |
], | |
[ | |
$class : 'GithubProjectProperty', | |
displayName : '', | |
projectUrlStr: "${GITHUB_PROJECT_URL}" | |
], | |
pipelineTriggers( | |
[ | |
[ | |
$class: 'hudson.triggers.TimerTrigger', | |
spec : "*/5 * * * *" | |
] | |
] | |
) | |
] | |
) | |
stage 'Clean Workspace' | |
deleteDir() | |
sh 'ls -lah' | |
sh 'env' | |
stage 'Checkout Source' | |
sh "git config --global user.name ${GITHUB_USER_NAME}" | |
sh "git config --global user.email ${GITHUB_USER_EMAIL}" | |
checkout scm | |
sh 'chmod +x *.sh' | |
stage 'Update dynamic-ip-myhosts' | |
sh './aws-update-my-dynamic-ip.sh dynamic-ip-myhosts' | |
} | |
catch (Exception ex) { | |
mail from: "${MAIL_FROM}", | |
to: "${MAIL_TO}", | |
subject: "[FAILURE] 💩 😵 [JENKINS] ${env.JOB_NAME} - Build # ${env.BUILD_NUMBER} - [FAILURE]! 👻 😭 ", | |
body: "${env.JOB_NAME} - Build # ${env.BUILD_NUMBER} - FAILURE (${ex.message})!" | |
throw ex | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Relation with: https://gist.github.com/frekele/f3fa6541629ec980ed5ead7fc9ebdbe1