-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
52 lines (43 loc) · 2.2 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env groovy
import org.apache.commons.io.FilenameUtils
Map ARCHIVES_PATH = [
"lamobo_R1": "openwrt/bin/targets/sunxi/cortexa7/openwrt-sunxi-cortexa7-lamobo_lamobo-r1-ext4-sdcard.img.gz",
"linksys-wrt1200ac": "openwrt/bin/targets/mvebu/cortexa9/openwrt-mvebu-cortexa9-linksys_wrt1200ac-squashfs-sysupgrade.bin",
"linksys-wrt1900ac": "openwrt/bin/targets/mvebu/cortexa9/openwrt-mvebu-cortexa9-linksys_wrt1900ac-v1-squashfs-sysupgrade.bin",
"ubnt-erx": "openwrt/bin/targets/ramips/mt7621/openwrt-ramips-mt7621-ubnt_edgerouter-x-squashfs-sysupgrade.bin",
"gl-mt1300": "openwrt/bin/targets/ramips/mt7621/openwrt-ramips-mt7621-glinet_gl-mt1300-squashfs-sysupgrade.bin",
"unifiac": "openwrt/bin/targets/ath79/generic/openwrt-ath79-generic-ubnt_unifiac-pro-squashfs-sysupgrade.bin",
"x86": "openwrt/bin/targets/x86/64/openwrt-x86-64-generic-ext4-combined-efi.img.gz"
]
String target_choices = (ARCHIVES_PATH.keySet() as String[]).join(',')
properties([
parameters([
booleanParam(name: 'CLEAN_BUILD', defaultValue: true, description: 'deletes contents of the directories /bin and /build_dir.'),
extendedChoice(defaultValue: "${target_choices}", description: 'Which target to build', multiSelectDelimiter: ',', name: 'TARGETS', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_MULTI_SELECT', value: "${target_choices}", visibleItemCount: 6),
])
])
String[] TARGETS = params.TARGETS.split(',')
// parallel task map
Map tasks = [failFast: false]
TARGETS.each { target ->
tasks[target] = { ->
node {
def UPLOAD_FILE = ARCHIVES_PATH[target]
def ARCHIVE_NAME = FilenameUtils.getBaseName(UPLOAD_FILE)
ws("${WORKSPACE}/../openwrt-build-script") {
stage('Checkout') {
// Get some code from a GitHub repository
checkout scm
}
// Mark the code checkout 'stage'....
tools = load "scripts/jenkins.groovy"
tools.build(target)
tools.publishArtifact(UPLOAD_FILE)
tools.githubRelease(UPLOAD_FILE, ARCHIVE_NAME)
}
}
}
}
stage("Parallel builds") {
parallel(tasks)
}