From 78139813d7e4957aedea0b9840747cef8070b686 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Tue, 28 Dec 2021 11:51:37 -0500 Subject: [PATCH] Handle `a_` and `b_` in incremental version numbers (#20) Co-authored-by: Tim Jacomb --- lib/pipeline.js | 4 +++- package-lock.json | 2 +- package.json | 2 +- test/pipeline-test.js | 3 +-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/pipeline.js b/lib/pipeline.js index 3bc32a6..0c48d9a 100644 --- a/lib/pipeline.js +++ b/lib/pipeline.js @@ -68,6 +68,8 @@ module.exports = { */ getArchiveUrl: (build_url, hash) => { let shortHash = hash.substring(0, 12); - return build_url + 'artifact/**/*' + shortHash + '*/*' + shortHash + '*/*zip*/archive.zip'; + // https://github.com/jenkinsci/incrementals-tools/pull/24 + let versionPattern = shortHash.replace(/[ab]/g, '$&*'); + return build_url + 'artifact/**/*' + versionPattern + '*/*' + versionPattern + '*/*zip*/archive.zip'; } }; diff --git a/package-lock.json b/package-lock.json index a703107..bc2b904 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "incrementals-publisher", - "version": "1.4.1", + "version": "1.4.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 0fceada..69d7a49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "incrementals-publisher", - "version": "1.4.1", + "version": "1.4.2", "description": "", "private": true, "main": "index.js", diff --git a/test/pipeline-test.js b/test/pipeline-test.js index 12ca256..f8f7e18 100644 --- a/test/pipeline-test.js +++ b/test/pipeline-test.js @@ -154,8 +154,7 @@ describe('The Pipeline helpers', () => { it('should generate an archive.zip URL', () => { let hash = 'acbd4'; const url = pipeline.getArchiveUrl(build_url, hash); - assert.ok(url); - assert.ok(url.match('archive.zip$')); + assert.strictEqual(url, 'https://ci.jenkins.io/job/structs-plugin/job/PR-36/3/artifact/**/*a*cb*d4*/*a*cb*d4*/*zip*/archive.zip'); }); });