commit | author | age
|
4a2f97
|
1 |
import jenkins.model.Jenkins |
TW |
2 |
|
6bbc19
|
3 |
@Library("BuildLib") _ |
4a2f97
|
4 |
|
caeb09
|
5 |
/** |
TW |
6 |
* Gets the commit hash from a Jenkins build object, if any |
|
7 |
*/ |
|
8 |
@NonCPS |
|
9 |
def commitHashForBuild( build ) { |
|
10 |
def scmAction = build?.actions.find { action -> action instanceof jenkins.scm.api.SCMRevisionAction } |
|
11 |
return scmAction?.revision?.hash |
|
12 |
} |
|
13 |
|
d49c44
|
14 |
@NonCPS |
TW |
15 |
String getChangedFilesList() { |
|
16 |
changedFiles = [] |
|
17 |
for (changeLogSet in currentBuild.changeSets) { |
|
18 |
for (entry in changeLogSet.getItems()) { // for each commit in the detected changes |
|
19 |
for (file in entry.getAffectedFiles()) { |
|
20 |
changedFiles.add(file.getPath()) // add changed file to list |
|
21 |
} |
|
22 |
} |
|
23 |
} |
|
24 |
return changedFiles |
|
25 |
} |
|
26 |
|
6bbc19
|
27 |
pipeline { |
TW |
28 |
agent { |
|
29 |
node { |
|
30 |
label 'userland' |
|
31 |
} |
|
32 |
} |
|
33 |
stages { |
33a37d
|
34 |
stage('Ensure is ready to build') { |
TW |
35 |
steps { |
332bc2
|
36 |
sh 'pfexec /usr/sbin/mountall -F nfs || exit 0' |
33a37d
|
37 |
} |
TW |
38 |
} |
6bbc19
|
39 |
stage('Git Checkout') { |
TW |
40 |
steps { |
|
41 |
withSharedWs() { |
|
42 |
git branch: 'oi/hipster', url: 'https://github.com/OpenIndiana/oi-userland.git' |
|
43 |
} |
|
44 |
} |
|
45 |
} |
|
46 |
stage('Gmake Setup') { |
|
47 |
steps { |
|
48 |
sh 'rm -f components/components.mk' |
|
49 |
sh 'rm -f components/depends.mk' |
34f00b
|
50 |
withPublisher('openindiana.org', 'incremental') { |
6bbc19
|
51 |
sh 'gmake setup' |
TW |
52 |
} |
|
53 |
} |
|
54 |
} |
|
55 |
stage('Gmake Publish') { |
|
56 |
steps { |
34f00b
|
57 |
withPublisher('openindiana.org', 'incremental') { |
4a2f97
|
58 |
script { |
75fdcc
|
59 |
writeFile file: 'changed_files.txt', text: getChangedFilesList().join("\n") |
4a2f97
|
60 |
} |
771159
|
61 |
sh './tools/jenkinshelper-main.ksh -s build_changed' |
6bbc19
|
62 |
} |
TW |
63 |
} |
|
64 |
} |
34f00b
|
65 |
stage('update system') { |
TW |
66 |
steps { |
|
67 |
update() |
894422
|
68 |
sh '/opt/local/bin/cleanup_bootenvs.sh' |
34f00b
|
69 |
} |
TW |
70 |
} |
6bbc19
|
71 |
} |
TW |
72 |
} |
|
73 |
|