diff --git a/Jenkinsfile b/Jenkinsfile index 975e273..3e05757 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,21 @@ * */ +import groovy.json.JsonSlurper + +@NonCPS +def jsonParse(def json) { + def result = new JsonSlurper().parse(json) + return result +} + +def getLatestSdkUrl() { + def url = new URL('http://downloads.creatordev.io/openwrt/release.json') + def ci40 = jsonParse(url) + def latestSdkUrl = "http://downloads.creatordev.io/openwrt/latest/pistachio/marduk/OpenWrt-SDK-${ci40.versions.openwrt}-${ci40.board}_${ci40.versions.toolchain}.tar.bz2" + return latestSdkUrl +} + def creatorPackages = [ 'awalwm2m', 'bit-bang-gpio', @@ -23,7 +38,7 @@ def creatorPackages = [ properties([ buildDiscarder(logRotator(numToKeepStr: '30')), parameters([ - stringParam(defaultValue: 'http://downloads.creatordev.io/openwrt/ci40-v1.1.1/pistachio/marduk/OpenWrt-SDK-ci40-v1.1.1-pistachio_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2', + stringParam(defaultValue: getLatestSdkUrl(), description: 'OpenWrt SDK tarball to use', name: "SDK_TARBALL"), ]) ])