From 3bef703f248e21bb1e55909310a9d6059c845069 Mon Sep 17 00:00:00 2001 From: bernat Date: Thu, 19 Mar 2020 00:45:00 +0100 Subject: [PATCH] Add scalability script to Jenkinsfile --- Jenkinsfile | 90 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 79 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 271872d70..0f795b431 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,5 @@ +#!/usr/bin/env groovy + pipeline { agent none @@ -9,13 +11,27 @@ pipeline stages { - stage('windows and ubuntu in parallel') + stage('Creating nodes') + { + agent { label "master" } + steps + { + script + { + JOB_ID = "${env.BUILD_TAG}" + jenkinsLib = load("/home/jenkins/jenkins.groovy") + + jenkinsLib.CreateBuildNode(JOB_ID) + } + } + } + stage('Building CARLA') { parallel { stage('ubuntu') { - agent { label 'ubuntu && build' } + agent { label "ubuntu && build && ${JOB_ID}" } environment { UE4_ROOT = '/home/jenkins/UnrealEngine_4.22' @@ -77,17 +93,32 @@ pipeline sh 'make package ARGS="--packages=AdditionalMaps --clean-intermediate"' sh 'make examples ARGS="localhost 3654"' } - post { - always { + post + { + always + { archiveArtifacts 'Dist/*.tar.gz' stash includes: 'Dist/CARLA*.tar.gz', name: 'ubuntu_package' stash includes: 'Examples/', name: 'ubuntu_examples' } + success + { + node('master') + { + script + { + JOB_ID = "${env.BUILD_TAG}" + jenkinsLib = load("/home/jenkins/jenkins.groovy") + + jenkinsLib.CreateTestNode(JOB_ID) + } + } + } } } stage('ubuntu smoke tests') { - agent { label 'ubuntu && gpu' } + agent { label "ubuntu && gpu && ${JOB_ID}" } steps { unstash name: 'ubuntu_eggs' @@ -105,6 +136,16 @@ pipeline archiveArtifacts 'CarlaUE4.log' junit 'Build/test-results/smoke-tests-*.xml' deleteDir() + node('master') + { + script + { + JOB_ID = "${env.BUILD_TAG}" + jenkinsLib = load("/home/jenkins/jenkins.groovy") + + jenkinsLib.DeleteTestNode(JOB_ID) + } + } } } } @@ -137,8 +178,15 @@ pipeline git push ''' } + post + { + always + { + deleteDir() + } + } } - stage('Cleanning') + stage('Cleaning') { steps { @@ -149,7 +197,7 @@ pipeline } // stage('windows') // { - // agent { label 'windows && build' } + // agent { label "windows && build && ${JOB_ID}" } // environment // { // UE4_ROOT = 'C:\\Program Files\\Epic Games\\UE_4.22' @@ -175,8 +223,8 @@ pipeline // make LibCarla // make PythonAPI // make CarlaUE4Editor - // // make examples - // // """ + // """ + // // make examples // } // post // { @@ -208,9 +256,9 @@ pipeline // bat """ // call ../setEnv64.bat // make package - // make package ARGS="--packages=AdditionalMaps --clean-intermediate" + // make package ARGS="--packages=AdditionalMaps --clean" // """ - // // make examples ARGS="localhost 3654" + // // make examples ARGS="localhost 3654" // } // post { // always { @@ -235,8 +283,28 @@ pipeline // } // } // } + // post + // { + // always { deleteDir() } + // } // } } } } + post + { + always + { + node('master') + { + script + { + JOB_ID = "${env.BUILD_TAG}" + jenkinsLib = load("/home/jenkins/jenkins.groovy") + + jenkinsLib.DeleteBuildNode(JOB_ID) + } + } + } + } }