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

feat(1958): Upgrade hapiv19 dependencies. BREAKING CHANGE: new major data-schema version #470

Merged
merged 9 commits into from
Aug 28, 2020
2 changes: 1 addition & 1 deletion lib/baseFactory.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const schema = require('screwdriver-data-schema');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const PAGINATE_PAGE = 1;
const PAGINATE_COUNT = 50;

Expand Down
4 changes: 2 additions & 2 deletions lib/build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

const boom = require('boom');
const boom = require('@hapi/boom');
const dayjs = require('dayjs');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const deepcopy = require('deepcopy');
const logger = require('screwdriver-logger');
const { PR_JOB_NAME, EXTERNAL_TRIGGER } = require('screwdriver-data-schema').config.regex;
Expand Down
2 changes: 1 addition & 1 deletion lib/buildFactory.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const imageParser = require('docker-parse-image');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const logger = require('screwdriver-logger');
const BaseFactory = require('./baseFactory');
const Build = require('./build');
Expand Down
2 changes: 1 addition & 1 deletion lib/event.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const dayjs = require('dayjs');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const BaseModel = require('./base');

class EventModel extends BaseModel {
Expand Down
2 changes: 1 addition & 1 deletion lib/helper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const schema = require('screwdriver-data-schema');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const dayjs = require('dayjs');
const TEMPLATE_NAME_REGEX_WITH_NAMESPACE = schema.config.regex.FULL_TEMPLATE_NAME_WITH_NAMESPACE;
const formatDate = dateTime => dayjs(dateTime).format('YYYY-MM-DD');
Expand Down
2 changes: 1 addition & 1 deletion lib/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const logger = require('screwdriver-logger');
const dayjs = require('dayjs');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const BaseModel = require('./base');
const { getAnnotations, getAllRecords, getToken } = require('./helper');
const executor = Symbol('executor');
Expand Down
2 changes: 1 addition & 1 deletion lib/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

const parser = require('screwdriver-config-parser');
const workflowParser = require('screwdriver-workflow-parser');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const dayjs = require('dayjs');
const _ = require('lodash');
const { PR_JOB_NAME, EXTERNAL_TRIGGER_ALL } = require('screwdriver-data-schema').config.regex;
Expand Down
2 changes: 1 addition & 1 deletion lib/secret.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const iron = require('iron');
const iron = require('@hapi/iron');
const BaseModel = require('./base');
// Get symbols for private fields
const password = Symbol('password');
Expand Down
2 changes: 1 addition & 1 deletion lib/secretFactory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const iron = require('iron');
const iron = require('@hapi/iron');
const BaseFactory = require('./baseFactory');
const Secret = require('./secret');
// Get symbols for private fields
Expand Down
2 changes: 1 addition & 1 deletion lib/templateFactory.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const compareVersions = require('compare-versions');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const schema = require('screwdriver-data-schema');
const BaseFactory = require('./baseFactory');
const Template = require('./template');
Expand Down
2 changes: 1 addition & 1 deletion lib/templateTagFactory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const schema = require('screwdriver-data-schema');
const BaseFactory = require('./baseFactory');
const TemplateTag = require('./templateTag');
Expand Down
2 changes: 1 addition & 1 deletion lib/user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const iron = require('iron');
const iron = require('@hapi/iron');
const BaseModel = require('./base');
// Get symbols for private fields
const password = Symbol('password');
Expand Down
2 changes: 1 addition & 1 deletion lib/userFactory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const iron = require('iron');
const iron = require('@hapi/iron');
const BaseFactory = require('./baseFactory');
const User = require('./user');
// Get symbols for private fields
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "screwdriver-models",
"version": "23.0.0",
"version": "28.0.0",
"description": "Screwdriver models",
"main": "index.js",
"scripts": {
"pretest": "eslint . --quiet",
"test": "nyc --report-dir ./artifacts/coverage --reporter=lcov mocha --recursive --timeout 4000 --retries 1 --exit --color true",
"test": "nyc --report-dir ./artifacts/coverage --reporter=lcov mocha --recursive --timeout 10000 --retries 1 --exit --color true",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"repository": {
Expand Down Expand Up @@ -37,28 +37,28 @@
},
"devDependencies": {
"chai": "^4.2.0",
"eslint": "^6.8.0",
"eslint": "^7.7.0",
"eslint-config-screwdriver": "^5.0.3",
"mocha": "^7.1.0",
"mocha": "^8.1.2",
"mockery": "^2.0.0",
"rewire": "^4.0.1",
"rewire": "^5.0.0",
"nyc": "^15.0.0",
"sinon": "^7.5.0"
"sinon": "^9.0.3"
},
"dependencies": {
"@hapi/boom": "^9.1.0",
"@hapi/hoek": "^9.0.4",
"@hapi/iron": "^6.0.0",
"async": "^2.6.3",
"base64url": "^3.0.1",
"boom": "^7.3.0",
"compare-versions": "^3.6.0",
"dayjs": "^1.8.27",
"deepcopy": "^2.0.0",
"docker-parse-image": "^3.0.1",
"hoek": "^5.0.4",
"iron": "^5.0.6",
"lodash": "^4.17.15",
"screwdriver-config-parser": "^5.3.3",
"screwdriver-data-schema": "^19.10.1",
"screwdriver-config-parser": "^6.0.0",
"screwdriver-data-schema": "^20.0.0",
"screwdriver-logger": "^1.0.0",
"screwdriver-workflow-parser": "^2.0.3"
"screwdriver-workflow-parser": "^3.0.0"
}
}
3 changes: 2 additions & 1 deletion screwdriver.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
shared:
image: node:8
image: node:12

jobs:
main:
environment:
SD_SONAR_OPTS: "-Dsonar.sources=lib -Dsonar.javascript.lcov.reportPath=artifacts/coverage/lcov.info"
NODE_OPTIONS: "--max_old_space_size=8192"
requires: [~pr, ~commit]
steps:
- install: npm install
Expand Down
2 changes: 1 addition & 1 deletion test/lib/job.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { assert } = require('chai');
const mockery = require('mockery');
const sinon = require('sinon');
const schema = require('screwdriver-data-schema');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const rewire = require('rewire');
const dayjs = require('dayjs');
const MAX_COUNT = 1000;
Expand Down
6 changes: 4 additions & 2 deletions test/lib/pipeline.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { assert } = require('chai');
const mockery = require('mockery');
const sinon = require('sinon');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const schema = require('screwdriver-data-schema');
const rewire = require('rewire');
const dayjs = require('dayjs');
Expand Down Expand Up @@ -644,11 +644,13 @@ describe('Pipeline Model', () => {
jobFactoryMock.list.resolves(jobs);
jobFactoryMock.create.withArgs(publishMock).resolves(publishMock);
jobFactoryMock.create.withArgs(mainMock).resolves(mainMock);
buildClusterFactoryMock.list.resolves(sdBuildClusters);

return pipeline.sync().then(() => {
assert.deepEqual(pipeline.annotations, {
'beta.screwdriver.cd/executor': 'screwdriver-executor-vm',
'screwdriver.cd/chainPR': true
'screwdriver.cd/chainPR': true,
'screwdriver.cd/buildCluster': 'sd1'
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/lib/secret.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Secret Model', () => {
defaults: {}
};

mockery.registerMock('iron', ironMock);
mockery.registerMock('@hapi/iron', ironMock);

// eslint-disable-next-line global-require
BaseModel = require('../../lib/base');
Expand Down
2 changes: 1 addition & 1 deletion test/lib/secretFactory.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Secret Factory', () => {
defaults: 'defaults'
};

mockery.registerMock('iron', ironMock);
mockery.registerMock('@hapi/iron', ironMock);

// eslint-disable-next-line global-require
Secret = require('../../lib/secret');
Expand Down
2 changes: 1 addition & 1 deletion test/lib/token.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { assert } = require('chai');
const sinon = require('sinon');
const mockery = require('mockery');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const schema = require('screwdriver-data-schema');

sinon.assert.expose(assert, { prefix: '' });
Expand Down
2 changes: 1 addition & 1 deletion test/lib/user.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('User Model', () => {
};

mockery.registerMock('screwdriver-hashr', hashaMock);
mockery.registerMock('iron', ironMock);
mockery.registerMock('@hapi/iron', ironMock);
mockery.registerMock('./tokenFactory', {
getInstance: sinon.stub().returns(tokenFactoryMock)
});
Expand Down
2 changes: 1 addition & 1 deletion test/lib/userFactory.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('User Factory', () => {
};

mockery.registerMock('screwdriver-hashr', hashaMock);
mockery.registerMock('iron', ironMock);
mockery.registerMock('@hapi/iron', ironMock);
mockery.registerMock('./tokenFactory', {
getInstance: sinon.stub().returns(tokenFactoryMock)
});
Expand Down