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

fix: correct timeout for deploy during scratch org creation #771

Merged
merged 8 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
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
# deployRetrieveNuts:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/org/scratchOrgCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ export const scratchOrgResume = async (jobId: string): Promise<ScratchOrgCreateR

export const scratchOrgCreate = async (options: ScratchOrgCreateOptions): Promise<ScratchOrgCreateResult> => {
const logger = await Logger.child('scratchOrgCreate');
/** epoch milliseconds */
const startTimestamp = Date.now();

logger.debug('scratchOrgCreate');
await emit({ stage: 'prepare request' });
Expand Down Expand Up @@ -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))
),
]);

Expand Down
5 changes: 3 additions & 2 deletions src/org/scratchOrgInfoApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> => {
const logger = await Logger.child('scratchOrgInfoApi-deploySettings');
if (orgSettings.hasSettings()) {
Expand All @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions src/org/scratchOrgSettingsGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ export default class SettingsGenerator {
/**
* Deploys the settings to the org.
*/
public async deploySettingsViaFolder(scratchOrg: Org, apiVersion: string): Promise<void> {
public async deploySettingsViaFolder(
scratchOrg: Org,
apiVersion: string,
timeout: Duration = Duration.minutes(10)
): Promise<void> {
const username = scratchOrg.getUsername();
const logger = await Logger.child('deploySettingsViaFolder');

Expand Down Expand Up @@ -274,7 +278,7 @@ export default class SettingsGenerator {
};
}
},
timeout: Duration.minutes(10),
timeout,
frequency: Duration.seconds(1),
timeoutErrorName: 'DeployingSettingsTimeoutError',
};
Expand Down
88 changes: 16 additions & 72 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -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"
Expand Down