From 88bcd3a75bcc0074f2400eb5e0d5913252a8ec37 Mon Sep 17 00:00:00 2001 From: klu909 Date: Mon, 12 Dec 2022 16:30:31 -0800 Subject: [PATCH 1/2] feat(2683): nodejs upgrade BREAKING CHANGE: Node 18 upgrade && eslint upgrade --- .gitignore | 1 + package.json | 32 ++++++++++++++------------------ screwdriver.yaml | 2 +- test/index.test.js | 16 +++++++++++++++- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 9614fd2..b4fdfbc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ npm-debug.log .DS_STORE .*.swp .nyc_output/ +package-lock.json \ No newline at end of file diff --git a/package.json b/package.json index 7e2d69e..803167c 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,15 @@ { "name": "screwdriver-executor-router", - "version": "2.0.0", + "version": "3.0.0", "description": "A generic plugin for routing builds to specified executors", "main": "index.js", "scripts": { "pretest": "eslint . --quiet", - "test": "nyc --report-dir ./artifacts/coverage --reporter=lcov mocha --reporter mocha-multi-reporters --reporter-options configFile=./mocha.config.json --recursive --timeout 4000 --retries 1 --exit --allow-uncaught true --color true", - "semantic-release": "semantic-release pre && npm publish && semantic-release post" + "test": "nyc --report-dir ./artifacts/coverage --reporter=lcov mocha --reporter mocha-multi-reporters --reporter-options configFile=./mocha.config.json --recursive --timeout 4000 --retries 1 --exit --allow-uncaught true --color true" }, "repository": { "type": "git", - "url": "git@github.com:screwdriver-cd/executor-router.git" + "url": "git+https://github.com/screwdriver-cd/executor-router.git" }, "homepage": "https://github.com/screwdriver-cd/executor-router", "bugs": "https://github.com/screwdriver-cd/screwdriver/issues", @@ -32,25 +31,22 @@ "Tiffany Kyi " ], "devDependencies": { - "chai": "^4.2.0", - "eslint": "^6.8.0", - "eslint-config-screwdriver": "^5.0.3", - "mocha": "^8.2.1", + "chai": "^4.3.7", + "eslint": "^8.28.0", + "eslint-config-screwdriver": "^7.0.0", + "mocha": "^10.1.0", "mocha-multi-reporters": "^1.5.1", "mocha-sonarqube-reporter": "^1.0.2", - "mockery": "^2.0.0", - "nyc": "^15.0.0", - "sinon": "^4.5.0" + "mockery": "^2.1.0", + "nyc": "^15.1.0", + "sinon": "^15.0.0" }, "dependencies": { - "screwdriver-data-schema": "^21.0.0", - "screwdriver-executor-base": "^8.3.0", - "screwdriver-logger": "^1.0.0" + "screwdriver-data-schema": "^22.0.1", + "screwdriver-executor-base": "^9.0.0", + "screwdriver-logger": "^2.0.0" }, "release": { - "debug": false, - "verifyConditions": { - "path": "./node_modules/semantic-release/src/lib/plugin-noop.js" - } + "debug": false } } diff --git a/screwdriver.yaml b/screwdriver.yaml index 046a496..554ea6c 100644 --- a/screwdriver.yaml +++ b/screwdriver.yaml @@ -1,5 +1,5 @@ shared: - image: node:12 + image: node:18 jobs: main: diff --git a/test/index.test.js b/test/index.test.js index 54a047a..e092d94 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -410,6 +410,8 @@ describe('index test', () => { }); describe('_stop', () => { + const apiUri = 'https://api.sd.cd'; + it('default executor when no annotation is given', () => { executor = new Executor({ defaultPlugin: 'example', @@ -429,6 +431,7 @@ describe('index test', () => { return executor .stop({ + apiUri, buildId: 920 }) .then(result => { @@ -441,6 +444,7 @@ describe('index test', () => { return executor .stop({ + apiUri, buildId: 920 }) .then(result => { @@ -456,6 +460,7 @@ describe('index test', () => { return executor .stop({ + apiUri, annotations: { 'beta.screwdriver.cd/executor': 'darrenIsSometimesRight' }, @@ -468,12 +473,13 @@ describe('index test', () => { }); }); - it('uses an annotation to determine which executor to call', () => { + it('uses an annotation to determine which executorn to call', () => { k8sExecutorMock._stop.rejects(); exampleExecutorMock._stop.resolves('exampleExecutorResult'); return executor .stop({ + apiUri, annotations: { 'beta.screwdriver.cd/executor': 'example' }, @@ -493,6 +499,7 @@ describe('index test', () => { return executor .stop({ + apiUri, annotations: { 'beta.screwdriver.cd/executor': 'k8s' }, @@ -615,6 +622,8 @@ describe('index test', () => { }); describe('Executor config with weightage', () => { + const apiUri = 'https://api.sd.cd'; + beforeEach(() => { executor = new Executor({ ecosystem, @@ -671,6 +680,7 @@ describe('index test', () => { return executor .stop({ + apiUri, buildId: 920 }) .then(result => { @@ -714,6 +724,7 @@ describe('index test', () => { return executor .stop({ + apiUri, buildId: 920 }) .then(() => { @@ -770,6 +781,7 @@ describe('index test', () => { return executor ._stop({ + apiUri, buildId: 920 }) .then(result => { @@ -787,6 +799,7 @@ describe('index test', () => { return executor .stop({ + apiUri, annotations: { 'beta.screwdriver.cd/executor': 'k8s-vm' }, @@ -823,6 +836,7 @@ describe('index test', () => { return executor ._stop({ + apiUri, buildId: 920 }) .then(result => { From 206133f6413c2740f93919c1665967f10984cec4 Mon Sep 17 00:00:00 2001 From: klu909 <55161078+klu909@users.noreply.github.com> Date: Tue, 13 Dec 2022 09:09:57 -0800 Subject: [PATCH 2/2] Update test/index.test.js Co-authored-by: Tiffany K --- test/index.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.test.js b/test/index.test.js index e092d94..b8684b6 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -473,7 +473,7 @@ describe('index test', () => { }); }); - it('uses an annotation to determine which executorn to call', () => { + it('uses an annotation to determine which executor to call', () => { k8sExecutorMock._stop.rejects(); exampleExecutorMock._stop.resolves('exampleExecutorResult');