diff --git a/scripts/linkbot/monitor-ub-server.js b/scripts/linkbot/monitor-ub-server.js index 836166d..28bfb6e 100644 --- a/scripts/linkbot/monitor-ub-server.js +++ b/scripts/linkbot/monitor-ub-server.js @@ -5,7 +5,7 @@ const { updateURLLink } = require('./common'); const target = "UBUNTU_SERVER_RPI_IMAGE_URL" const url = "http://cdimage.ubuntu.com/ubuntu/releases/" -const reg = ".*(?[0-9]{2})\.04\.?(?[0-9]{1})?.*" +const reg = ".*(?[0-9][02468])\.04\.?(?[0-9]{1})?.*" // Read the input file, and parse the variable input try { @@ -26,12 +26,13 @@ JSDOM.fromURL(url, {}).then(dom => { var refs = document.getElementsByTagName("a"); var matches = Array.from(refs) .filter(ref => ref.textContent.match(reg)) + .filter(ref => !ref.textContent.match(reg).groups.minor) // Ignore the minor number .reduce((acc, ref) => { acc.push(ref.textContent.match(reg)) return acc }, []) .sort((a,b) => { - return parseInt(b.groups.release) - parseInt(a.groups.release) || parseFloat(b.groups.minor) - parseFloat(a.groups.minor) + return parseInt(b.groups.release) - parseInt(a.groups.release) }) var matchOn = matches[0].input @@ -44,10 +45,10 @@ JSDOM.fromURL(url, {}).then(dom => { JSDOM.fromURL(`${url}${releaseVersion}/release/`, {}).then(dom => { var document = dom.window.document; var refs = document.getElementsByTagName("a"); - const match = Array.from(refs).find(ref => ref.href.match(`.*ubuntu-${releaseVersion}-preinstalled-server-armhf.*\.img\.xz$`)) + const match = Array.from(refs).find(ref => ref.href.match(`.*ubuntu-${releaseVersion}\.?[0-9]+-preinstalled-server-armhf.*\.img\.xz$`)) if (match) { console.log(`Ubuntu server image has a new release: ${match}`) - updateURLLink(`${target}=${match}`, target) + updateURLLink(`${target}=\"${match}\"`, target) } }) }); diff --git a/scripts/test/run-tests.sh b/scripts/test/run-tests.sh index daf476e..9b5d993 100755 --- a/scripts/test/run-tests.sh +++ b/scripts/test/run-tests.sh @@ -29,7 +29,7 @@ RASPBIAN_IMAGE_URL="http://downloads.raspberrypi.org/raspbian_lite/images/raspbi UBUNTU_IMAGE_URL="https://downloads.mender.io/mender-convert/images/Ubuntu-Bionic-x86-64.img.gz" ## Auto-update -UBUNTU_SERVER_RPI_IMAGE_URL="http://cdimage.ubuntu.com/ubuntu/releases/20.04.2/release/ubuntu-20.04.2-preinstalled-server-armhf+raspi.img.xz" +UBUNTU_SERVER_RPI_IMAGE_URL="http://cdimage.ubuntu.com/ubuntu/releases/20.04/release/ubuntu-20.04.2-preinstalled-server-armhf+raspi.img.xz" # Keep common function declarations in separate utils script UTILS_PATH=${0/$(basename $0)/test-utils.sh}