Browse Source

linkbot: Move the LTS verification from the filter to the regexp

Changelog: None
Signed-off-by: Ole Petter <ole.orhagen@northern.tech>
2.6.x
Ole Petter 3 years ago
parent
commit
924fe70950
No known key found for this signature in database GPG Key ID: 399DBE0F4D4B02EB
  1. 3
      scripts/linkbot/monitor-ub-server.js

3
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 = ".*(?<release>[0-9]{2})\.04\.?(?<minor>[0-9]{1})?.*"
const reg = ".*(?<release>[0-9][02468])\.04\.?(?<minor>[0-9]{1})?.*"
// Read the input file, and parse the variable input
try {
@ -26,7 +26,6 @@ JSDOM.fromURL(url, {}).then(dom => {
var refs = document.getElementsByTagName("a");
var matches = Array.from(refs)
.filter(ref => ref.textContent.match(reg))
.filter(ref => parseInt(ref.textContent.match(reg).groups.release) % 2 == 0) // Only LTS
.filter(ref => !ref.textContent.match(reg).groups.minor) // Ignore the minor number
.reduce((acc, ref) => {
acc.push(ref.textContent.match(reg))

Loading…
Cancel
Save