diff --git a/.harness/ci-cd.yaml b/.harness/ci-cd.yaml index e2abc6a45..c55ce475d 100644 --- a/.harness/ci-cd.yaml +++ b/.harness/ci-cd.yaml @@ -36,19 +36,22 @@ pipeline: execution: steps: - step: - type: Action + type: Run name: Set up Node.js identifier: Set_up_Nodejs spec: - uses: dcodeIO/setup-node-nvm@master - with: - node-version: lts/* + shell: Bash + command: |- + curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - + sudo apt-get install -y nodejs + node --version + npm --version - step: type: Run name: Install Redis identifier: Install_Redis spec: - shell: Sh + shell: Bash command: |- sudo add-apt-repository ppa:redislabs/redis sudo apt-get install -y redis-tools redis-server @@ -56,28 +59,15 @@ pipeline: type: Run name: Check Redis identifier: Check_Redis - spec: - shell: Sh - command: redis-cli ping - - step: - type: Run - name: Install Chrome - identifier: Install_Chrome spec: shell: Bash - command: |- - curl -fsSL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /tmp/chrome.deb - apt-get update -qq && apt-get install -y -qq /tmp/chrome.deb || true - # Fallback: install via chromium if the .deb install failed - which google-chrome-stable || apt-get install -y -qq chromium-browser - CHROME_BIN=$(which google-chrome-stable || which chromium-browser || which chromium) - echo "CHROME_BIN=$CHROME_BIN" + command: redis-cli ping - step: type: Run name: npm ci identifier: npm_ci spec: - shell: Sh + shell: Bash command: npm ci envVariables: PUPPETEER_SKIP_DOWNLOAD: "true" @@ -86,15 +76,26 @@ pipeline: name: npm ts tests identifier: npm_ts_tests spec: - shell: Sh + shell: Bash command: npm run test-ts-decls - step: type: Run name: npm run check identifier: npm_run_check spec: - shell: Sh + shell: Bash command: npm run check + - step: + type: Run + name: Install Chrome + identifier: Install_Chrome + spec: + shell: Bash + command: |- + curl -fsSL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /tmp/chrome.deb + sudo apt-get update -qq + sudo apt-get install -y -qq /tmp/chrome.deb + google-chrome-stable --version - step: type: Run name: npm test-browser @@ -102,47 +103,44 @@ pipeline: spec: shell: Bash command: |- - CHROME_BIN=$(which google-chrome-stable || which chromium-browser || which chromium) - export CHROME_BIN + export CHROME_BIN=$(which google-chrome-stable) npm run test-browser - step: type: Run name: npm test-node identifier: npm_test_node spec: - shell: Sh + shell: Bash command: npm run test-node - step: type: Run name: npm run build identifier: npm_run_build spec: - shell: Sh + shell: Bash command: BUILD_BRANCH=<+codebase.branch> npm run build - parallel: - step: - type: Run + type: S3Upload name: upload dev assets to CDN identifier: upload_dev_assets_to_CDN spec: - shell: Sh - command: aws s3 sync ./umd s3://split-public-stage/sdk --acl public-read --follow-symlinks --cache-control max-age=31536000,public - connectorRef: artifacts - envVariables: - AWS_DEFAULT_REGION: us-east-1 + connectorRef: publicassetsstage + region: us-east-1 + bucket: split-public-stage + sourcePath: ./umd/* when: stageStatus: Success condition: <+trigger.event> == "PUSH" && <+trigger.branch> == "development" - step: - type: Run + type: S3Upload name: upload prod assets to CDN identifier: upload_prod_assets_to_CDN spec: - shell: Sh - command: aws s3 sync ./umd s3://split-public/sdk --acl public-read --follow-symlinks --cache-control max-age=31536000,public - connectorRef: artifacts - envVariables: - AWS_DEFAULT_REGION: us-east-1 + connectorRef: publicassetsprod + region: us-east-1 + bucket: split-public + sourcePath: ./umd/* when: stageStatus: Success condition: <+trigger.event> == "PUSH" && <+trigger.branch> == "main" diff --git a/.harness/input-set.yaml b/.harness/input-set.yaml index 6cd665e2f..9685cd846 100644 --- a/.harness/input-set.yaml +++ b/.harness/input-set.yaml @@ -1,5 +1,6 @@ inputSet: name: javascript-client + tags: {} identifier: javascriptclient orgIdentifier: PROD projectIdentifier: Harness_Split diff --git a/.harness/java-script-client-prod.yaml b/.harness/java-script-client-prod.yaml new file mode 100644 index 000000000..fc5909f4b --- /dev/null +++ b/.harness/java-script-client-prod.yaml @@ -0,0 +1,24 @@ +inputSet: + name: javascript-client-prod + identifier: javascriptclientprod + orgIdentifier: PROD + projectIdentifier: Harness_Split + pipeline: + identifier: javascriptclient + properties: + ci: + codebase: + build: + type: branch + spec: + branch: <+trigger.branch> + stages: + - stage: + identifier: Check_Test_Build_Upload + type: CI + spec: + infrastructure: + type: KubernetesDirect + spec: + connectorRef: use1prod1cd + serviceAccountName: use1-prod-1-mfe-assets diff --git a/.harness/javascriptclient.yaml b/.harness/javascriptclient.yaml new file mode 100644 index 000000000..8d1ffde85 --- /dev/null +++ b/.harness/javascriptclient.yaml @@ -0,0 +1,24 @@ +inputSet: + name: javascript-client-prod + identifier: javascriptclient + orgIdentifier: PROD + projectIdentifier: Harness_Split + pipeline: + identifier: javascriptclient + properties: + ci: + codebase: + build: + type: branch + spec: + branch: <+trigger.branch> + stages: + - stage: + identifier: Check_Test_Build_Upload + type: CI + spec: + infrastructure: + type: KubernetesDirect + spec: + connectorRef: use1prod1cd + serviceAccountName: use1-prod-1-mfe-assets diff --git a/package-lock.json b/package-lock.json index 5a712a391..3a102bfb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@splitsoftware/splitio", - "version": "11.11.2", + "version": "11.11.2-rc.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@splitsoftware/splitio", - "version": "11.11.2", + "version": "11.11.2-rc.1", "license": "Apache-2.0", "dependencies": { "@splitsoftware/splitio-commons": "2.12.1", @@ -1234,9 +1234,9 @@ "license": "MIT" }, "node_modules/body-parser": { - "version": "1.20.5", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.5.tgz", - "integrity": "sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA==", + "version": "1.20.6", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.6.tgz", + "integrity": "sha512-p5tAzS57i5MV9fZFDj9LeIiTZEufbSe2eDozP+ElheSUq1m74CRq1jI4mYNDdVs9vQztXFLuk/Gd6BWTdwRJ5g==", "dev": true, "license": "MIT", "dependencies": { @@ -1274,9 +1274,9 @@ "dev": true }, "node_modules/brace-expansion": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz", - "integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==", + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz", + "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==", "dev": true, "license": "MIT", "dependencies": { @@ -3036,9 +3036,9 @@ "dev": true }, "node_modules/fast-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.2.tgz", - "integrity": "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz", + "integrity": "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==", "dev": true, "funding": [ { @@ -4492,9 +4492,9 @@ } }, "node_modules/js-yaml": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", - "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz", + "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==", "funding": [ { "type": "github", @@ -4656,9 +4656,9 @@ } }, "node_modules/karma-webpack/node_modules/brace-expansion": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz", - "integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz", + "integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==", "dev": true, "license": "MIT", "dependencies": { @@ -7051,9 +7051,9 @@ "license": "MIT" }, "node_modules/socket.io-parser": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.6.tgz", - "integrity": "sha512-asJqbVBDsBCJx0pTqw3WfesSY0iRX+2xzWEWzrpcH7L6fLzrhyF8WPI8UaeM4YCuDfpwA/cgsdugMsmtz8EJeg==", + "version": "4.2.7", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.7.tgz", + "integrity": "sha512-IH/iSeO9T6gz1KkFleGDWkG9N3dl4jXVYUtMhIqH10Md0ttMer8nUNWiP1DKuNrybD2xBrixLJdCC9J6ECoYkg==", "dev": true, "license": "MIT", "dependencies": { @@ -9535,9 +9535,9 @@ "dev": true }, "body-parser": { - "version": "1.20.5", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.5.tgz", - "integrity": "sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA==", + "version": "1.20.6", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.6.tgz", + "integrity": "sha512-p5tAzS57i5MV9fZFDj9LeIiTZEufbSe2eDozP+ElheSUq1m74CRq1jI4mYNDdVs9vQztXFLuk/Gd6BWTdwRJ5g==", "dev": true, "requires": { "bytes": "~3.1.2", @@ -9572,9 +9572,9 @@ } }, "brace-expansion": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.14.tgz", - "integrity": "sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g==", + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz", + "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==", "dev": true, "requires": { "balanced-match": "^1.0.0", @@ -10907,9 +10907,9 @@ "dev": true }, "fast-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.2.tgz", - "integrity": "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz", + "integrity": "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==", "dev": true }, "fastest-levenshtein": { @@ -11856,9 +11856,9 @@ } }, "js-yaml": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", - "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz", + "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==", "requires": { "argparse": "^2.0.1" } @@ -11995,9 +11995,9 @@ }, "dependencies": { "brace-expansion": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz", - "integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz", + "integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==", "dev": true, "requires": { "balanced-match": "^1.0.0" @@ -13776,9 +13776,9 @@ } }, "socket.io-parser": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.6.tgz", - "integrity": "sha512-asJqbVBDsBCJx0pTqw3WfesSY0iRX+2xzWEWzrpcH7L6fLzrhyF8WPI8UaeM4YCuDfpwA/cgsdugMsmtz8EJeg==", + "version": "4.2.7", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.7.tgz", + "integrity": "sha512-IH/iSeO9T6gz1KkFleGDWkG9N3dl4jXVYUtMhIqH10Md0ttMer8nUNWiP1DKuNrybD2xBrixLJdCC9J6ECoYkg==", "dev": true, "requires": { "@socket.io/component-emitter": "~3.1.0", diff --git a/package.json b/package.json index 4a0f2ce18..a52c1dcd9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio", - "version": "11.11.2", + "version": "11.11.2-rc.1", "description": "Split SDK", "files": [ "README.md", diff --git a/src/__tests__/offline/browser.spec.js b/src/__tests__/offline/browser.spec.js index 8b5436c2d..89726352e 100644 --- a/src/__tests__/offline/browser.spec.js +++ b/src/__tests__/offline/browser.spec.js @@ -24,6 +24,19 @@ const replySpy = spy => { return 200; }; +// polls `condition` until it's true or `timeout` ms elapse, instead of a fixed wait, to avoid flakiness under CI load +const waitUntil = (condition, timeout = 10000, interval = 1000) => { + const start = Date.now(); + return new Promise((resolve, reject) => { + const check = () => { + if (condition()) return resolve(); + if (Date.now() - start >= timeout) return reject(new Error('waitUntil timed out')); + setTimeout(check, interval); + }; + check(); + }); +}; + const configMocks = () => { fetchMock.mock(new RegExp(`${url(settings, '/splitChanges/')}.*`), () => replySpy(spySplitChanges)); fetchMock.mock(new RegExp(`${url(settings, '/segmentChanges/')}.*`), () => replySpy(spySegmentChanges)); @@ -328,8 +341,8 @@ tape('Browser offline mode', function (assert) { testing_not_exist: { treatment: 'control', config: null } }); - // timeout to wait SDK_UPDATE on all factories - setTimeout(() => { + // wait for SDK_UPDATE on all factories + waitUntil(() => updateCount === factories.length - 1).then(() => { const destroyPromises = [ sharedClient.destroy(), client.destroy(), ...factories.map(f => f.client().destroy()) @@ -359,7 +372,10 @@ tape('Browser offline mode', function (assert) { assert.end(); }); + }, err => { + assert.fail(err.message); + assert.end(); }); - }, 3500); + }); }); }); diff --git a/src/settings/defaults/version.js b/src/settings/defaults/version.js index 6972d945c..b2584aa05 100644 --- a/src/settings/defaults/version.js +++ b/src/settings/defaults/version.js @@ -1 +1 @@ -export const packageVersion = '11.11.2'; +export const packageVersion = '11.11.2-rc.1';