summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Scrieciu <catalin.scrieciu@enea.com>2016-07-15 13:13:57 +0200
committerCatalin Scrieciu <catalin.scrieciu@enea.com>2016-07-15 13:13:57 +0200
commitb0347f6eb67d332a4b5556ffe430239ee7e37086 (patch)
tree1915f63ab9a9c580f5195820278005ca91cc70f3
parentbbd6e460f4f00aedef846b8511428431eecff0b1 (diff)
downloadel_manifests-standard-b0347f6eb67d332a4b5556ffe430239ee7e37086.tar.gz
test
-rw-r--r--Jenkinsfile75
1 files changed, 69 insertions, 6 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index c69fc5e..f6c4cfd 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,19 @@
1import groovy.io.FileType 1import groovy.io.FileType
2=====USER DEFINED VARIABLES=====
3def images_to_buid = ['enea-image-'+profile','enea-image-'+profile+'-sdk', 'world']
4def localGitRoot = 'http://git.enea.se/cgit/various/'
5def publicGitRoot = 'http://git.enea.com/cgit/linux/'
6
7=====USER DEFINED FUNCTIONS=====
8
9def getProfile(){
10 return 'standard'
11}
12
13def getReleaseLayer(){
14 releaseLayer = 'meta-el-'+getProfile()
15 return releaseLayer
16}
2 17
3@NonCPS def getTargets(){ 18@NonCPS def getTargets(){
4 targetList = [] 19 targetList = []
@@ -7,6 +22,21 @@ import groovy.io.FileType
7 return targetList 22 return targetList
8} 23}
9 24
25def imageBuild(){
26 print 'test'
27}
28
29def imageBuild(machine, profile, buildStamp, releaseLayer){
30 {
31 it-> node{
32 print machine
33 print profile
34 print buildStamp
35 print releaseLayer
36 }
37 }
38}
39
10def targetBuild(trg){ 40def targetBuild(trg){
11 { 41 {
12 target=trg-> node{ 42 target=trg-> node{
@@ -16,7 +46,7 @@ def targetBuild(trg){
16 checkout([$class: 'RepoScm', 46 checkout([$class: 'RepoScm',
17 currentBranch: true, 47 currentBranch: true,
18 manifestBranch: '$BRANCH_NAME', 48 manifestBranch: '$BRANCH_NAME',
19 manifestFile: trg+'default.xml', 49 manifestFile: trg+'/default.xml',
20 //The hardcoded repository should be replaced by a generic name, eg. $GIT_PATH+el_manifests-$PROFILE 50 //The hardcoded repository should be replaced by a generic name, eg. $GIT_PATH+el_manifests-$PROFILE
21 manifestRepositoryUrl: 'http://git.enea.se/cgit/various/el_manifests-standard.git', 51 manifestRepositoryUrl: 'http://git.enea.se/cgit/various/el_manifests-standard.git',
22 quiet: true, 52 quiet: true,
@@ -31,11 +61,20 @@ def targetBuild(trg){
31 submoduleCfg: [], 61 submoduleCfg: [],
32 userRemoteConfigs: [[credentialsId: 'a797f854-983e-473e-b221-6d8ebafda16a', 62 userRemoteConfigs: [[credentialsId: 'a797f854-983e-473e-b221-6d8ebafda16a',
33 url: 'git@git.enea.se:linux/meta-enea-test.git']]]) 63 url: 'git@git.enea.se:linux/meta-enea-test.git']]])
64 stash includes: 'poky/*', name: trg+'_poky', useDefaultExcludes: false
34 } 65 }
35 } 66 }
67 def buildImageMap = [:]
68 for (image in images_to_buid){
69 def imageId = image+'_build'
70 buildImageMap[imageId] = imageBuild(imageId)
71 }
72 parallel buildImageMap
36 } 73 }
37} 74}
38 75
76=====ENVIRONMENT SETUP=====
77
39/* 78/*
40Defining the first stage of the pipeline. 79Defining the first stage of the pipeline.
41This stage prepares the workspace and the build environment, clones ELTF scripts and 80This stage prepares the workspace and the build environment, clones ELTF scripts and
@@ -73,22 +112,46 @@ node {
73 112
74 // Parse directory structure in order to determine the target list 113 // Parse directory structure in order to determine the target list
75 targetList = getTargets() 114 targetList = getTargets()
76 for (item in targetList) {print item} 115
116 // Determine needed information like the EL Profile or the release layer to be used later as environment variables
117 profile = getProfile()
118 releaseLayer = getReleaseLayer()
119 buildStamp = BUILD_ID
120 print profile
121 print releaseLayer
122 print buildStamp
123
77 124
78 print 'Finished stage Environment Setup' 125 print 'Finished stage Environment Setup'
79} 126}
80 127
128=====BUILD=====
129
130/*
131Defining the seond stage of the pipeline, the Build stege
132This stage defines the threads to be run in parallel for each target, based on
133the list of targets identified in previous stage. It then runs each thread in
134parallel. The steps in each thread are defined in the closure retuned by the
135targetBuild function. When all parallel threads are finished, a message is
136printed on the console.
137*/
138
81stage 'Build' 139stage 'Build'
82// Create the build map which defines the build threads 140// Create the build map which defines the build threads
83def buildMap = [:] 141def buildTargetMap = [:]
84for (item in targetList){ 142for (item in targetList){
85 def id = item+'_build' 143 def id = item+'_build'
86 buildMap[id] = targetBuild(item) 144 buildTargetMap[id] = targetBuild(item)
87} 145}
88parallel buildMap 146// Run threads for each target in parallel
147parallel buildTargetMap
148
89node { 149node {
90 print 'Finished stage Build' 150 print 'Finished stage Build'
91} 151}
152
153=====TEST=====
154
92stage 'Test' 155stage 'Test'
93node { 156node {
94 print 'Finished stage Test' 157 print 'Finished stage Test'