Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jenkinsfile: pull latest image from downloads server #46

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#!/usr/bin/env groovy

import groovy.json.JsonSlurper

@NonCPS
def jsonParse(def jsonUrl) {
def result = new JsonSlurper().parse(jsonUrl)
return result
}

def getLatestImageUrl() {
def ci40 = jsonParse(new URL('http://downloads.creatordev.io/openwrt/release.json'))
def latestImageUrl = "http://downloads.creatordev.io/openwrt/latest/pistachio/marduk/openWrt-${ci40.versions.openwrt}-${ci40.board}-${ci40.profile}-squashfs-factory.ubi"
return latestImageUrl
}

def configureDut() {
sh 'echo "ifconfig eth0 up" > /dev/ttyUSB0'
sh 'echo "ifconfig eth1 up" > /dev/ttyUSB0'
Expand Down Expand Up @@ -27,8 +43,7 @@ properties([
Path to a directory containing the packages folder,\
if null defaults to the directory of the image',
name: "PACKAGES_PATH"),
stringParam(defaultValue:
'http://downloads.creatordev.io/openwrt/ci40-v1.1.0/pistachio/marduk/openwrt-v1.1.0-pistachio-marduk-squashfs-factory.ubi',
stringParam(defaultValue: getLatestImageUrl(),
description:
'Either path directly to the image, or path to a Jenkins job from where to get the image',
name: "IMAGE_PATH"),
Expand Down