From b0347f6eb67d332a4b5556ffe430239ee7e37086 Mon Sep 17 00:00:00 2001 From: Catalin Scrieciu Date: Fri, 15 Jul 2016 13:13:57 +0200 Subject: test --- Jenkinsfile | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 6 deletions(-) (limited to 'Jenkinsfile') diff --git a/Jenkinsfile b/Jenkinsfile index c69fc5e..f6c4cfd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,19 @@ import groovy.io.FileType +=====USER DEFINED VARIABLES===== +def images_to_buid = ['enea-image-'+profile','enea-image-'+profile+'-sdk', 'world'] +def localGitRoot = 'http://git.enea.se/cgit/various/' +def publicGitRoot = 'http://git.enea.com/cgit/linux/' + +=====USER DEFINED FUNCTIONS===== + +def getProfile(){ + return 'standard' +} + +def getReleaseLayer(){ + releaseLayer = 'meta-el-'+getProfile() + return releaseLayer +} @NonCPS def getTargets(){ targetList = [] @@ -7,6 +22,21 @@ import groovy.io.FileType return targetList } +def imageBuild(){ + print 'test' +} + +def imageBuild(machine, profile, buildStamp, releaseLayer){ + { + it-> node{ + print machine + print profile + print buildStamp + print releaseLayer + } + } +} + def targetBuild(trg){ { target=trg-> node{ @@ -16,7 +46,7 @@ def targetBuild(trg){ checkout([$class: 'RepoScm', currentBranch: true, manifestBranch: '$BRANCH_NAME', - manifestFile: trg+'default.xml', + manifestFile: trg+'/default.xml', //The hardcoded repository should be replaced by a generic name, eg. $GIT_PATH+el_manifests-$PROFILE manifestRepositoryUrl: 'http://git.enea.se/cgit/various/el_manifests-standard.git', quiet: true, @@ -31,11 +61,20 @@ def targetBuild(trg){ submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'a797f854-983e-473e-b221-6d8ebafda16a', url: 'git@git.enea.se:linux/meta-enea-test.git']]]) + stash includes: 'poky/*', name: trg+'_poky', useDefaultExcludes: false } - } + } + def buildImageMap = [:] + for (image in images_to_buid){ + def imageId = image+'_build' + buildImageMap[imageId] = imageBuild(imageId) + } + parallel buildImageMap } } +=====ENVIRONMENT SETUP===== + /* Defining the first stage of the pipeline. This stage prepares the workspace and the build environment, clones ELTF scripts and @@ -73,22 +112,46 @@ node { // Parse directory structure in order to determine the target list targetList = getTargets() - for (item in targetList) {print item} + + // Determine needed information like the EL Profile or the release layer to be used later as environment variables + profile = getProfile() + releaseLayer = getReleaseLayer() + buildStamp = BUILD_ID + print profile + print releaseLayer + print buildStamp + print 'Finished stage Environment Setup' } +=====BUILD===== + +/* +Defining the seond stage of the pipeline, the Build stege +This stage defines the threads to be run in parallel for each target, based on +the list of targets identified in previous stage. It then runs each thread in +parallel. The steps in each thread are defined in the closure retuned by the +targetBuild function. When all parallel threads are finished, a message is +printed on the console. +*/ + stage 'Build' // Create the build map which defines the build threads -def buildMap = [:] +def buildTargetMap = [:] for (item in targetList){ def id = item+'_build' - buildMap[id] = targetBuild(item) + buildTargetMap[id] = targetBuild(item) } -parallel buildMap +// Run threads for each target in parallel +parallel buildTargetMap + node { print 'Finished stage Build' } + +=====TEST===== + stage 'Test' node { print 'Finished stage Test' -- cgit v1.2.3-54-g00ecf