From 364985d849d29dc07f4c27c5e3e67e2f3b344ff6 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Mon, 13 Feb 2023 16:34:51 -0600 Subject: [PATCH 1/8] fix: correct timeout for deploy during scratch org creation --- src/org/scratchOrgCreate.ts | 6 +++++- src/org/scratchOrgInfoApi.ts | 5 +++-- src/org/scratchOrgSettingsGenerator.ts | 8 ++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/org/scratchOrgCreate.ts b/src/org/scratchOrgCreate.ts index 943ec5debe..76e0d6807d 100644 --- a/src/org/scratchOrgCreate.ts +++ b/src/org/scratchOrgCreate.ts @@ -191,6 +191,8 @@ export const scratchOrgResume = async (jobId: string): Promise => { const logger = await Logger.child('scratchOrgCreate'); + /** epoch milliseconds */ + const startTimestamp = Date.now(); logger.debug('scratchOrgCreate'); await emit({ stage: 'prepare request' }); @@ -296,7 +298,9 @@ export const scratchOrgCreate = async (options: ScratchOrgCreateOptions): Promis settingsGenerator, apiversion ?? configAggregator.getPropertyValue(OrgConfigProperties.ORG_API_VERSION) ?? - (await scratchOrg.retrieveMaxApiVersion()) + (await scratchOrg.retrieveMaxApiVersion()), + // some of our "wait" time has already been used. Calculate how much remains that we can spend on the deployment. + Duration.milliseconds(wait.milliseconds - (Date.now() - startTimestamp)) ), ]); diff --git a/src/org/scratchOrgInfoApi.ts b/src/org/scratchOrgInfoApi.ts index ba99ecfb56..24b9d62f7c 100644 --- a/src/org/scratchOrgInfoApi.ts +++ b/src/org/scratchOrgInfoApi.ts @@ -394,7 +394,8 @@ export const pollForScratchOrgInfo = async ( export const deploySettings = async ( scratchOrg: Org, orgSettings: SettingsGenerator, - apiVersion: string + apiVersion: string, + timeout: Duration = Duration.minutes(10) ): Promise => { const logger = await Logger.child('scratchOrgInfoApi-deploySettings'); if (orgSettings.hasSettings()) { @@ -403,7 +404,7 @@ export const deploySettings = async ( try { await orgSettings.createDeploy(); - await orgSettings.deploySettingsViaFolder(scratchOrg, apiVersion); + await orgSettings.deploySettingsViaFolder(scratchOrg, apiVersion, timeout); // updating the revision num to zero during org:creation if source members are created during org:create. // This only happens for some specific scratch org definition file. await updateRevisionCounterToZero(scratchOrg); diff --git a/src/org/scratchOrgSettingsGenerator.ts b/src/org/scratchOrgSettingsGenerator.ts index a3e501bfc5..593ff02587 100644 --- a/src/org/scratchOrgSettingsGenerator.ts +++ b/src/org/scratchOrgSettingsGenerator.ts @@ -236,7 +236,11 @@ export default class SettingsGenerator { /** * Deploys the settings to the org. */ - public async deploySettingsViaFolder(scratchOrg: Org, apiVersion: string): Promise { + public async deploySettingsViaFolder( + scratchOrg: Org, + apiVersion: string, + timeout: Duration = Duration.minutes(10) + ): Promise { const username = scratchOrg.getUsername(); const logger = await Logger.child('deploySettingsViaFolder'); @@ -274,7 +278,7 @@ export default class SettingsGenerator { }; } }, - timeout: Duration.minutes(10), + timeout, frequency: Duration.seconds(1), timeoutErrorName: 'DeployingSettingsTimeoutError', }; From 11a4c97dcd77772e60e83912c0d95bcdb596f4e0 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 21 Feb 2023 13:39:17 -0600 Subject: [PATCH 2/8] chore: dep bump --- package.json | 2 +- yarn.lock | 88 ++++++++++------------------------------------------ 2 files changed, 17 insertions(+), 73 deletions(-) diff --git a/package.json b/package.json index f2000e2211..e342361c67 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ ], "dependencies": { "@salesforce/bunyan": "^2.0.0", - "@salesforce/kit": "^1.8.0", + "@salesforce/kit": "^1.9.0", "@salesforce/schemas": "^1.4.0", "@salesforce/ts-types": "^1.7.2", "@types/graceful-fs": "^4.1.5", diff --git a/yarn.lock b/yarn.lock index 3e19447e5b..0db7134871 100644 --- a/yarn.lock +++ b/yarn.lock @@ -678,14 +678,14 @@ typescript "^4.1.3" wireit "^0.9.3" -"@salesforce/kit@^1.8.0": - version "1.8.0" - resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-1.8.0.tgz#d5b8d83d5b0b866cb76840dc7a18e115589d86a0" - integrity sha512-Pr9CWAIzVYKZRWvM76lyhEtF3CPmVdIfgbqRD7KT/YZdbLstX3KHYBxCyx3TyWZr5qROv96n+jRIBiIFI9LGGw== +"@salesforce/kit@^1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-1.9.0.tgz#ddc179ff588b68f3e8f5c237ab74ed4b9c8d5274" + integrity sha512-a1DnVf2ZN/fZ4Zq0T6pxrDpwOyWSKt6Es1erpUJLvM13H+Y3C4uxSUy4aS4WSHIJA8zvWvvEiWYOV17TD0Dmug== dependencies: - "@salesforce/ts-types" "^1.7.1" + "@salesforce/ts-types" "^1.7.3" shx "^0.3.3" - tslib "^2.2.0" + tslib "^2.5.0" "@salesforce/prettier-config@^0.0.2": version "0.0.2" @@ -706,12 +706,12 @@ sinon "^5.1.1" tslib "^2.2.0" -"@salesforce/ts-types@^1.7.1", "@salesforce/ts-types@^1.7.2": - version "1.7.2" - resolved "https://registry.yarnpkg.com/@salesforce/ts-types/-/ts-types-1.7.2.tgz#ab40399d291c7eca57efc9890daf2fa2632197ec" - integrity sha512-eCpWKEb03UCKBJ6Svp0Vwcwt+fG6BQbopO4x5wt6CYeT8Rjt0dbDQicZPmVL59j2qyt3Q4Y4EYsxXUGZmdfvDw== +"@salesforce/ts-types@^1.7.2", "@salesforce/ts-types@^1.7.3": + version "1.7.3" + resolved "https://registry.yarnpkg.com/@salesforce/ts-types/-/ts-types-1.7.3.tgz#89b79ff0aaa55fea9f2de0afa8e515be3e17d0d8" + integrity sha512-jpmekGqZ7tpHRJwf1rF0yBJ/IMC5mOrryNi4HZkKuNQn8RF97WpynmL8Om04mLTCESvCiif3y7NWfIcxtID2Gw== dependencies: - tslib "^2.4.1" + tslib "^2.5.0" "@sinonjs/commons@^1", "@sinonjs/commons@^1.3.0", "@sinonjs/commons@^1.6.0", "@sinonjs/commons@^1.7.0", "@sinonjs/commons@^1.8.1": version "1.8.3" @@ -2454,51 +2454,6 @@ eslint-visitor-keys@^3.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@^8.31.0: - version "8.31.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.31.0.tgz#75028e77cbcff102a9feae1d718135931532d524" - integrity sha512-0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA== - dependencies: - "@eslint/eslintrc" "^1.4.1" - "@humanwhocodes/config-array" "^0.11.8" - "@humanwhocodes/module-importer" "^1.0.1" - "@nodelib/fs.walk" "^1.2.8" - ajv "^6.10.0" - chalk "^4.0.0" - cross-spawn "^7.0.2" - debug "^4.3.2" - doctrine "^3.0.0" - escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" - eslint-utils "^3.0.0" - eslint-visitor-keys "^3.3.0" - espree "^9.4.0" - esquery "^1.4.0" - esutils "^2.0.2" - fast-deep-equal "^3.1.3" - file-entry-cache "^6.0.1" - find-up "^5.0.0" - glob-parent "^6.0.2" - globals "^13.19.0" - grapheme-splitter "^1.0.4" - ignore "^5.2.0" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - is-glob "^4.0.0" - is-path-inside "^3.0.3" - js-sdsl "^4.1.4" - js-yaml "^4.1.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.4.1" - lodash.merge "^4.6.2" - minimatch "^3.1.2" - natural-compare "^1.4.0" - optionator "^0.9.1" - regexpp "^3.2.0" - strip-ansi "^6.0.1" - strip-json-comments "^3.1.0" - text-table "^0.2.0" - eslint@^8.32.0: version "8.32.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.32.0.tgz#d9690056bb6f1a302bd991e7090f5b68fbaea861" @@ -2703,18 +2658,7 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@^3.0.3, fast-glob@^3.2.9: - version "3.2.11" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" - integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fast-glob@^3.2.11: +fast-glob@^3.0.3, fast-glob@^3.2.11, fast-glob@^3.2.9: version "3.2.12" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== @@ -5993,10 +5937,10 @@ tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.0, tslib@^2.0.3, tslib@^2.2.0, tslib@^2.3.1, tslib@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" - integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== +tslib@^2.0.0, tslib@^2.0.3, tslib@^2.2.0, tslib@^2.3.1, tslib@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" + integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== tsutils@^3.21.0: version "3.21.0" From cc9b4ed23c9062f96924f6de5804b3e792140709 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 21 Feb 2023 15:27:54 -0600 Subject: [PATCH 3/8] test: correct modules path for ext nuts --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eac4508859..8c14c74fef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,7 @@ jobs: command: 'yarn test:nuts' os: ${{ matrix.os }} useCache: false - preBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules@salesforce/core' + preBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core' secrets: inherit # hidden until we fix source-testkit to better handle jwt # deployRetrieveNuts: From 9604529b6f9ce3ba35671e6dc354950567f89ebf Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 21 Feb 2023 15:41:55 -0600 Subject: [PATCH 4/8] test: remove jsforce typings --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c14c74fef..7babde4f31 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,7 @@ jobs: command: 'yarn test:nuts' os: ${{ matrix.os }} useCache: false - preBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core' + preBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core node_modules/jsforce/typings' secrets: inherit # hidden until we fix source-testkit to better handle jwt # deployRetrieveNuts: From e23bd22aae82377b3280d95626d7ad3d6e7e42f6 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 21 Feb 2023 16:02:58 -0600 Subject: [PATCH 5/8] test: remove core's jsforce typing --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7babde4f31..fe84805353 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,7 @@ jobs: command: 'yarn test:nuts' os: ${{ matrix.os }} useCache: false - preBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core node_modules/jsforce/typings' + preBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core node_modules/@salesforce/core/node_modules/jsforce/typings' secrets: inherit # hidden until we fix source-testkit to better handle jwt # deployRetrieveNuts: From 7b8a2af02b90eb9fc52b865bd42f3a0e019b74ff Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 21 Feb 2023 16:19:49 -0600 Subject: [PATCH 6/8] test: 2 separate delete commands? --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fe84805353..3820216da9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,7 @@ jobs: command: 'yarn test:nuts' os: ${{ matrix.os }} useCache: false - preBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core node_modules/@salesforce/core/node_modules/jsforce/typings' + preBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core; shx rm -rf node_modules/@salesforce/core/node_modules/jsforce/typings' secrets: inherit # hidden until we fix source-testkit to better handle jwt # deployRetrieveNuts: From 5d59d84813fa9e17658c710bf2d923dbbfa0bab1 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 21 Feb 2023 16:37:01 -0600 Subject: [PATCH 7/8] test: module dedupe in correct workingDir --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3820216da9..6ad7276dbf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,8 @@ jobs: command: 'yarn test:nuts' os: ${{ matrix.os }} useCache: false - preBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core; shx rm -rf node_modules/@salesforce/core/node_modules/jsforce/typings' + preBuildCommands: 'shx rm -rf node_modules/jsforce/typings' + preExternalBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core' secrets: inherit # hidden until we fix source-testkit to better handle jwt # deployRetrieveNuts: From 804b9b5b7d03781accb0aa3df0ee53b7e20cf21d Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 21 Feb 2023 16:41:40 -0600 Subject: [PATCH 8/8] test: delete duplicate faye typings AFTER core build --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6ad7276dbf..02ffdde057 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,7 @@ jobs: command: 'yarn test:nuts' os: ${{ matrix.os }} useCache: false - preBuildCommands: 'shx rm -rf node_modules/jsforce/typings' + postBuildCommands: 'shx rm -rf node_modules/jsforce/typings' preExternalBuildCommands: 'shx rm -rf node_modules/@salesforce/sf-plugins-core/node_modules/@salesforce/core' secrets: inherit # hidden until we fix source-testkit to better handle jwt