Created
April 10, 2019 10:31
-
-
Save judavi/69300928554fd6b67130ebbb51e7343c to your computer and use it in GitHub Desktop.
Jenkins Start new node/agent container and send emails
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
def label = "mypod-${UUID.randomUUID().toString()}" | |
podTemplate(label: label, cloud: 'myKubernetesCluster', | |
containers:[ | |
containerTemplate(name: 'jnlp', | |
alwaysPullImage: true, | |
resourceRequestMemory: '4Gi', | |
resourceLimitMemory: '4Gi', | |
resourceRequestCpu: '1000m', resourceLimitCpu: '1000m', | |
workingDir: '/home/jenkins/workspace', | |
envVars: [envVar(key:'JENKINS_ENV', value:'DEV')], | |
command: '/home/jenkins/jenkins-slave', | |
image: 'myBeatyJenkinsAgentImage:1', | |
ttyEnabled: true) | |
] | |
) | |
{ | |
node(label) { | |
stage('rebooting') { | |
def rc = sh( | |
script: 'echo "empanada"', | |
returnStdout : true | |
).trim() | |
echo "es una ${rc}" | |
emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}", | |
recipientProviders: [[$class: 'DevelopersRecipientProvider'], | |
[$class: 'RequesterRecipientProvider']], | |
subject: "Container Build ${currentBuild.currentResult}: ${rc} Job ${env.JOB_NAME}", | |
to: "[email protected]" | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment