diff options
author | Andrei Gheorghiu <adgh@eltf-jenkins02.stolab01.enea.se> | 2016-09-14 14:35:45 +0200 |
---|---|---|
committer | Andrei Gheorghiu <adgh@eltf-jenkins02.stolab01.enea.se> | 2016-09-14 14:35:45 +0200 |
commit | 8360fc4cf7a5f01835f99ac1398b13970baa0c9e (patch) | |
tree | 1de2d1d1b724381a265102bb89cd926451b45696 /Jenkinsfile | |
parent | fe75f088b15777718303d9811494ed5437515468 (diff) | |
download | el_manifests-standard-8360fc4cf7a5f01835f99ac1398b13970baa0c9e.tar.gz |
multibranch test 0.2
Diffstat (limited to 'Jenkinsfile')
-rw-r--r-- | Jenkinsfile | 91 |
1 files changed, 9 insertions, 82 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index 7bb5422..04aba0b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile | |||
@@ -1,84 +1,11 @@ | |||
1 | // Defining the closure to be used for building a target | 1 | #!/bin/env groovy |
2 | |||
3 | def target_build = {machine-> | ||
4 | print "This is the build for target $machine" | ||
5 | // sh 'mkdir $machine' | ||
6 | // dir ('$machine') { | ||
7 | // pwd() | ||
8 | // unstash 'eltf_scripts' | ||
9 | // } | ||
10 | } | ||
11 | |||
12 | def constructor_function(trg) {{it->print "This is another build for the target $trg"}} | ||
13 | |||
14 | node { | ||
15 | // Start the fist stage which sets up the pipeline environment | ||
16 | stage 'Set up environment' | ||
17 | // Cleaning the workspace | ||
18 | deleteDir() | ||
19 | |||
20 | // The first step is to freeze the manifest repositiries | ||
21 | print "To add a job to freeze the manifest repositories" | ||
22 | |||
23 | def targets = TARGET_LIST.split(',') | ||
24 | for (item in targets) {print item} | ||
25 | |||
26 | // Old implementation of the git clone. Changed as it does not support target directory | ||
27 | //git url: 'git@git.enea.se:eltf/scripts.git', branch: 'master', relativeTargetDir: 'eltf_scripts' | ||
28 | |||
29 | // Clone eltf/scripts.git repository | ||
30 | checkout([$class: 'GitSCM', | ||
31 | branches: [[name: '*/master']], | ||
32 | doGenerateSubmoduleConfigurations: false, | ||
33 | extensions: [[$class: 'RelativeTargetDirectory', | ||
34 | relativeTargetDir: 'eltf_scripts']], | ||
35 | submoduleCfg: [], | ||
36 | userRemoteConfigs: [[url: 'git@git.enea.se:eltf/scripts.git']]]) | ||
37 | |||
38 | // Stash the ELTF scripts in order to be used on other nodes | ||
39 | stash includes: 'eltf_scripts/*', name: 'eltf_scripts', useDefaultExcludes: false | ||
40 | |||
41 | // Start the next stages for Build, Test and Document | ||
42 | |||
43 | stage 'Build' | ||
44 | |||
45 | build_jobs = [:] | ||
46 | for (item in targets){build_jobs.put(item, constructor_function(item))} | ||
47 | print "I am here" | ||
48 | |||
49 | try { | ||
50 | parallel build_jobs | ||
51 | } | ||
52 | catch (java.io.NotSerializableException stupid_error){ | ||
53 | |||
54 | print "Finished parallel step and entered the catch statement" | ||
55 | print stupid_error | ||
56 | //stage 'Test' | ||
57 | print "hello from stage 3" | ||
58 | } | ||
59 | try { | ||
60 | stage 'Document' | ||
61 | print "hello from stage 4" | ||
62 | stage 'Build Documentation' | ||
63 | print "hello from stage 5" | ||
64 | stage 'Build Release Candidate' | ||
65 | echo "hello...it's me...:)" | ||
66 | stage 'Publish Release Candidate' | ||
67 | def PUBLISH_RC = input( | ||
68 | id: 'PUBLISH_RC', message: 'Publish RC?', ok: 'Yes', parameters: [ | ||
69 | [$class: 'StringParameterDefinition', defaultValue: 'RC1', description: 'This is the RC number to be published', name: 'RC_NUMBER'], | ||
70 | [$class: 'StringParameterDefinition', defaultValue: 'EL6_RC2', description: 'This is the tag to be applied in the manifest repo', name: 'RC_TAG'] | ||
71 | ]) | ||
72 | echo ("The RC number is: "+PUBLISH_RC['RC_NUMBER']) | ||
73 | print "hello from stage 5" | ||
74 | echo ("The RC number is: "+PUBLISH_RC['RC_NUMBER']) | ||
75 | stage 'Pubilsh Official Release' | ||
76 | echo ("The RC number is: "+PUBLISH_RC['RC_NUMBER']) | ||
77 | } | ||
78 | catch (err) { | ||
79 | print err | ||
80 | } | ||
81 | } | ||
82 | |||
83 | 2 | ||
3 | node ('master') { | ||
4 | println 'in node master: ' | ||
5 | sh 'env' | ||
6 | } | ||
84 | 7 | ||
8 | node ('builder') { | ||
9 | println 'in node builder: ' | ||
10 | sh 'env' | ||
11 | } | ||