The WeeFee
Dependencies: MbedJSONValue esp32-driver WebSocketClient JSON
Jenkinsfile@4:1b8288ef7cbc, 2018-12-18 (annotated)
- Committer:
- Tina Quach
- Date:
- Tue Dec 18 11:56:26 2018 -0500
- Revision:
- 4:1b8288ef7cbc
- Parent:
- 0:f6b0c22b2a78
parse server messages
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DVLevine | 0:f6b0c22b2a78 | 1 | properties ([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [ |
DVLevine | 0:f6b0c22b2a78 | 2 | [$class: 'StringParameterDefinition', name: 'mbed_os_revision', defaultValue: '', description: 'Revision of mbed-os to build. Use format "pull/PR-NUMBER/head" to access mbed-os PR'] |
DVLevine | 0:f6b0c22b2a78 | 3 | ]]]) |
DVLevine | 0:f6b0c22b2a78 | 4 | |
DVLevine | 0:f6b0c22b2a78 | 5 | if (params.mbed_os_revision == '') { |
DVLevine | 0:f6b0c22b2a78 | 6 | echo 'Use mbed OS revision from mbed-os.lib' |
DVLevine | 0:f6b0c22b2a78 | 7 | } else { |
DVLevine | 0:f6b0c22b2a78 | 8 | echo "Use mbed OS revisiong ${params.mbed_os_revision}" |
DVLevine | 0:f6b0c22b2a78 | 9 | if (params.mbed_os_revision.matches('pull/\\d+/head')) { |
DVLevine | 0:f6b0c22b2a78 | 10 | echo "Revision is a Pull Request" |
DVLevine | 0:f6b0c22b2a78 | 11 | } |
DVLevine | 0:f6b0c22b2a78 | 12 | } |
DVLevine | 0:f6b0c22b2a78 | 13 | |
DVLevine | 0:f6b0c22b2a78 | 14 | // List of targets with supported RF shields to compile |
DVLevine | 0:f6b0c22b2a78 | 15 | def targets = [ |
DVLevine | 0:f6b0c22b2a78 | 16 | "UBLOX_EVK_ODIN_W2": ["internal"], |
DVLevine | 0:f6b0c22b2a78 | 17 | "REALTEK_RTL8195AM": ["internal"], |
DVLevine | 0:f6b0c22b2a78 | 18 | "K64F": ["esp8266-driver"], |
DVLevine | 0:f6b0c22b2a78 | 19 | "NUCLEO_F429ZI": ["esp8266-driver"] |
DVLevine | 0:f6b0c22b2a78 | 20 | ] |
DVLevine | 0:f6b0c22b2a78 | 21 | |
DVLevine | 0:f6b0c22b2a78 | 22 | // Map toolchains to compilers |
DVLevine | 0:f6b0c22b2a78 | 23 | def toolchains = [ |
DVLevine | 0:f6b0c22b2a78 | 24 | ARM: "armcc", |
DVLevine | 0:f6b0c22b2a78 | 25 | GCC_ARM: "arm-none-eabi-gcc", |
DVLevine | 0:f6b0c22b2a78 | 26 | IAR: "IAR-linux" |
DVLevine | 0:f6b0c22b2a78 | 27 | ] |
DVLevine | 0:f6b0c22b2a78 | 28 | |
DVLevine | 0:f6b0c22b2a78 | 29 | // Supported RF shields |
DVLevine | 0:f6b0c22b2a78 | 30 | def radioshields = [ |
DVLevine | 0:f6b0c22b2a78 | 31 | "internal", |
DVLevine | 0:f6b0c22b2a78 | 32 | "esp8266-driver" |
DVLevine | 0:f6b0c22b2a78 | 33 | ] |
DVLevine | 0:f6b0c22b2a78 | 34 | |
DVLevine | 0:f6b0c22b2a78 | 35 | def stepsForParallel = [:] |
DVLevine | 0:f6b0c22b2a78 | 36 | |
DVLevine | 0:f6b0c22b2a78 | 37 | // Jenkins pipeline does not support map.each, we need to use oldschool for loop |
DVLevine | 0:f6b0c22b2a78 | 38 | for (int i = 0; i < targets.size(); i++) { |
DVLevine | 0:f6b0c22b2a78 | 39 | for(int j = 0; j < toolchains.size(); j++) { |
DVLevine | 0:f6b0c22b2a78 | 40 | for(int k = 0; k < radioshields.size(); k++) { |
DVLevine | 0:f6b0c22b2a78 | 41 | def target = targets.keySet().asList().get(i) |
DVLevine | 0:f6b0c22b2a78 | 42 | def allowed_shields = targets.get(target) |
DVLevine | 0:f6b0c22b2a78 | 43 | def toolchain = toolchains.keySet().asList().get(j) |
DVLevine | 0:f6b0c22b2a78 | 44 | def compilerLabel = toolchains.get(toolchain) |
DVLevine | 0:f6b0c22b2a78 | 45 | def radioshield = radioshields.get(k) |
DVLevine | 0:f6b0c22b2a78 | 46 | |
DVLevine | 0:f6b0c22b2a78 | 47 | def stepName = "${target} ${toolchain} ${radioshield}" |
DVLevine | 0:f6b0c22b2a78 | 48 | if(allowed_shields.contains(radioshield)) { |
DVLevine | 0:f6b0c22b2a78 | 49 | stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain, radioshield) |
DVLevine | 0:f6b0c22b2a78 | 50 | } |
DVLevine | 0:f6b0c22b2a78 | 51 | } |
DVLevine | 0:f6b0c22b2a78 | 52 | } |
DVLevine | 0:f6b0c22b2a78 | 53 | } |
DVLevine | 0:f6b0c22b2a78 | 54 | |
DVLevine | 0:f6b0c22b2a78 | 55 | timestamps { |
DVLevine | 0:f6b0c22b2a78 | 56 | parallel stepsForParallel |
DVLevine | 0:f6b0c22b2a78 | 57 | } |
DVLevine | 0:f6b0c22b2a78 | 58 | |
DVLevine | 0:f6b0c22b2a78 | 59 | def buildStep(target, compilerLabel, toolchain, radioShield) { |
DVLevine | 0:f6b0c22b2a78 | 60 | return { |
DVLevine | 0:f6b0c22b2a78 | 61 | stage ("${target}_${compilerLabel}_${radioShield}") { |
DVLevine | 0:f6b0c22b2a78 | 62 | node ("${compilerLabel}") { |
DVLevine | 0:f6b0c22b2a78 | 63 | deleteDir() |
DVLevine | 0:f6b0c22b2a78 | 64 | dir("mbed-os-example-wifi") { |
DVLevine | 0:f6b0c22b2a78 | 65 | checkout scm |
DVLevine | 0:f6b0c22b2a78 | 66 | def config_file = "mbed_app.json" |
DVLevine | 0:f6b0c22b2a78 | 67 | |
DVLevine | 0:f6b0c22b2a78 | 68 | // Set mbed-os to revision received as parameter |
DVLevine | 0:f6b0c22b2a78 | 69 | execute ("mbed deploy --protocol ssh") |
DVLevine | 0:f6b0c22b2a78 | 70 | if (params.mbed_os_revision != '') { |
DVLevine | 0:f6b0c22b2a78 | 71 | dir ("mbed-os") { |
DVLevine | 0:f6b0c22b2a78 | 72 | if (params.mbed_os_revision.matches('pull/\\d+/head')) { |
DVLevine | 0:f6b0c22b2a78 | 73 | execute("git fetch origin ${params.mbed_os_revision}:PR") |
DVLevine | 0:f6b0c22b2a78 | 74 | execute("git checkout PR") |
DVLevine | 0:f6b0c22b2a78 | 75 | } else { |
DVLevine | 0:f6b0c22b2a78 | 76 | execute ("git checkout ${params.mbed_os_revision}") |
DVLevine | 0:f6b0c22b2a78 | 77 | } |
DVLevine | 0:f6b0c22b2a78 | 78 | } |
DVLevine | 0:f6b0c22b2a78 | 79 | } |
DVLevine | 0:f6b0c22b2a78 | 80 | execute("mbed new .") |
DVLevine | 0:f6b0c22b2a78 | 81 | |
DVLevine | 0:f6b0c22b2a78 | 82 | execute ("mbed compile --build out/${target}_${toolchain}_${radioShield}/ -m ${target} -t ${toolchain} -c --app-config ${config_file}") |
DVLevine | 0:f6b0c22b2a78 | 83 | } |
DVLevine | 0:f6b0c22b2a78 | 84 | stash name: "${target}_${toolchain}_${radioShield}", includes: '**/mbed-os-example-wifi.bin' |
DVLevine | 0:f6b0c22b2a78 | 85 | archive '**/mbed-os-example-wifi.bin' |
DVLevine | 0:f6b0c22b2a78 | 86 | step([$class: 'WsCleanup']) |
DVLevine | 0:f6b0c22b2a78 | 87 | } |
DVLevine | 0:f6b0c22b2a78 | 88 | } |
DVLevine | 0:f6b0c22b2a78 | 89 | } |
DVLevine | 0:f6b0c22b2a78 | 90 | } |