From a7362e72781b3d835596ecdb722efb8e09a7589d Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 18:21:12 +0800 Subject: [PATCH 01/16] feat(js): add finalize package --- js/e2e/src/runner.ts | 2 +- js/finalize/index.ts | 82 +++++++++++++++++++++++++++++++++++++++ js/finalize/package.json | 23 +++++++++++ js/finalize/tsconfig.json | 19 +++++++++ js/package.json | 2 +- js/yarn.lock | 4 +- 6 files changed, 128 insertions(+), 4 deletions(-) create mode 100644 js/finalize/index.ts create mode 100644 js/finalize/package.json create mode 100644 js/finalize/tsconfig.json diff --git a/js/e2e/src/runner.ts b/js/e2e/src/runner.ts index 07b96614ed..ee64fc0608 100644 --- a/js/e2e/src/runner.ts +++ b/js/e2e/src/runner.ts @@ -25,7 +25,7 @@ interface TxResult { } // Message of launching complete -const LAUNCH_COMPLETE: string = "POLKADOT LAUNCH COMPLETE"; +export const LAUNCH_COMPLETE: string = "POLKADOT LAUNCH COMPLETE"; // Kill subprocesses function killAll(ps: ChildProcess, exitCode: number) { diff --git a/js/finalize/index.ts b/js/finalize/index.ts new file mode 100644 index 0000000000..3f869cb1fc --- /dev/null +++ b/js/finalize/index.ts @@ -0,0 +1,82 @@ +/** + * Test the finalization of parachain intergration + */ +import path from "path"; +import { Launch } from "@pint/e2e/src"; +import findUp from "find-up"; +import { ChildProcess, spawn } from "child_process"; + +// Message of launching complete +const LAUNCH_COMPLETE: string = "POLKADOT LAUNCH COMPLETE"; + +// PINT finalization regex +const PINT_FINALIZE: RegExp = /\[Parachain\].*finalized #(\d)/; + +// Kill subprocesses +function killAll(ps: ChildProcess, exitCode: number) { + try { + ps.send && !ps.killed && ps.send("exit"); + ps.kill("SIGINT"); + } catch (e) { + if (e.code !== "EPERM") { + process.stdout.write(e); + process.exit(2); + } + } + + process.exit(exitCode); +} + +/** + * Tail file and done when got expected message + */ +async function tail( + file: string, + match: (s: string) => boolean +): Promise { + new Promise(async (resolve) => { + const ps = spawn("tail", ["-f", file], { + cwd: path.resolve(String(await findUp("Cargo.toml")), ".."), + stdio: "pipe", + }); + + ps.stdout.on("data", (chunk: Buffer) => { + chunk && match(chunk.toString()) && resolve(null); + }); + }); +} + +/** + * Entrypoint + */ +async function main() { + const ps = await Launch.launch("pipe"); + ps.stdout.on("data", async (chunk: Buffer) => { + process.stdout.write(chunk.toString()); + if (chunk.includes(LAUNCH_COMPLETE)) { + await tail("9988.log", (chunk: string): boolean => { + process.stdout.write(chunk); + const match = chunk.match(PINT_FINALIZE); + return ( + match && match.length == 2 && Number.parseInt(match[1]) > 0 + ); + }); + + // console.log("FINALIZE SUCCEED!"); + // process.exit(0); + } + }); + + // Kill all processes when exiting. + process.on("exit", () => { + console.log("-> exit polkadot-launch..."); + killAll(ps, process.exitCode); + }); + + // Log errors + ps.stderr.on("data", (chunk: Buffer) => console.log(chunk.toString())); +} + +(() => { + main(); +})(); diff --git a/js/finalize/package.json b/js/finalize/package.json new file mode 100644 index 0000000000..80e939cf59 --- /dev/null +++ b/js/finalize/package.json @@ -0,0 +1,23 @@ +{ + "name": "@pint/finalization", + "version": "1.0.0", + "description": "Test the finalization in parachain intergration", + "main": "index.js", + "license": "MIT", + "private": true, + "devDependencies": { + "@types/node": "^15.3.1", + "ts-node": "^10.0.0", + "tslint": "^6.1.3", + "typescript": "^4.2.4" + }, + "dependencies": { + "@pint/e2e": "^1.0.0", + "find-up": "^5.0.0" + }, + "scripts": { + "start": "ts-node index.ts", + "build": "tsc --strict", + "lint": "tsc --noEmit --strict && tslint --project ./tsconfig.json" + } +} diff --git a/js/finalize/tsconfig.json b/js/finalize/tsconfig.json new file mode 100644 index 0000000000..8db1eddfc2 --- /dev/null +++ b/js/finalize/tsconfig.json @@ -0,0 +1,19 @@ +{ + "indent": [true, "spaces", 2], + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "baseUrl": ".", + "declaration": true, + "esModuleInterop": true, + "outDir": "lib", + "module": "commonjs", + "moduleResolution": "node", + "noImplicitAny": true, + "resolveJsonModule": true, + "sourceMap": true, + "skipLibCheck": true, + "target": "es6" + }, + "include": ["index.ts", "src/**/*"], + "exclude": ["node_modules"] +} diff --git a/js/package.json b/js/package.json index c82b4ad16e..dfffe3953f 100644 --- a/js/package.json +++ b/js/package.json @@ -1,4 +1,4 @@ { "private": true, - "workspaces": ["e2e", "pint-types-bundle"] + "workspaces": ["e2e", "pint-types-bundle", "finalize"] } diff --git a/js/yarn.lock b/js/yarn.lock index 78065d1876..206acc6020 100644 --- a/js/yarn.lock +++ b/js/yarn.lock @@ -136,7 +136,7 @@ "@polkadot/types" "4.15.1" "@polkadot/util" "^6.9.1" -"@polkadot/types@4.15.1", "@polkadot/types@^4.15.1", "@polkadot/types@^4.15.1": +"@polkadot/types@4.15.1", "@polkadot/types@^4.15.1": version "4.15.1" resolved "https://registry.nlark.com/@polkadot/types/download/@polkadot/types-4.15.1.tgz#03f32fd4ce81d69c43368d3e476c0421cedb8607" integrity sha1-A/Mv1M6B1pxDNo0+R2wEIc7bhgc= @@ -554,7 +554,7 @@ ext@^1.1.2: find-up@^5.0.0: version "5.0.0" - resolved "https://registry.npm.taobao.org/find-up/download/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + resolved "https://registry.nlark.com/find-up/download/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" integrity sha1-TJKBnstwg1YeT0okCoa+UZj1Nvw= dependencies: locate-path "^6.0.0" From ed916939df694a71a534998b9adffd5dbf78ab4a Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 18:41:49 +0800 Subject: [PATCH 02/16] feat(js): complete finalize script --- js/e2e/src/runner.ts | 4 +++- js/finalize/index.ts | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/js/e2e/src/runner.ts b/js/e2e/src/runner.ts index ee64fc0608..070dff6547 100644 --- a/js/e2e/src/runner.ts +++ b/js/e2e/src/runner.ts @@ -108,7 +108,9 @@ export default class Runner implements Config { }); // Log errors - ps.stderr.on("data", (chunk: Buffer) => console.log(chunk.toString())); + ps.stderr.on("data", (chunk: Buffer) => + process.stderr.write(chunk.toString()) + ); // Kill all processes when exiting. process.on("exit", () => { diff --git a/js/finalize/index.ts b/js/finalize/index.ts index 3f869cb1fc..46946fcc08 100644 --- a/js/finalize/index.ts +++ b/js/finalize/index.ts @@ -34,7 +34,7 @@ async function tail( file: string, match: (s: string) => boolean ): Promise { - new Promise(async (resolve) => { + return new Promise(async (resolve) => { const ps = spawn("tail", ["-f", file], { cwd: path.resolve(String(await findUp("Cargo.toml")), ".."), stdio: "pipe", @@ -62,8 +62,8 @@ async function main() { ); }); - // console.log("FINALIZE SUCCEED!"); - // process.exit(0); + console.log("FINALIZE SUCCEED!"); + process.exit(0); } }); @@ -74,7 +74,9 @@ async function main() { }); // Log errors - ps.stderr.on("data", (chunk: Buffer) => console.log(chunk.toString())); + ps.stderr.on("data", (chunk: Buffer) => + process.stderr.write(chunk.toString()) + ); } (() => { From d5e01247cff92c8374e995f269444971b33a092e Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 18:46:20 +0800 Subject: [PATCH 03/16] ci(finalize): add finalization test in CI --- .circleci/config.yml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c2b9f6ae9b..b38aca030f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -169,7 +169,32 @@ jobs: && cd js/e2e \ && yarn \ && yarn start - + docker-run-finalize: + executor: test-executor + description: Build and run e2e tests + steps: + - attach_workspace: + at: /tmp/workspace + - run: + name: Load Archived Docker Image + command: docker load -i /tmp/workspace/image.tar + - checkout + - run: + name: Build PINT launch Image + command: | + git submodule update --init + docker build -f docker/launch.Dockerfile -t launch . + - run: + name: Run e2e tests + command: | + sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | sudo bash \ + && source ~/.bashrc \ + && nvm install v15.9.0 \ + && nvm use v15.9.0 \ + && npm install yarn -g \ + && cd js/finalize \ + && yarn \ + && yarn start docker-publish-latest: executor: test-executor description: Publish latest Docker Image @@ -216,6 +241,9 @@ workflows: - docker-run-e2e: requires: - docker-build-release + - docker-run-finalize: + requires: + - docker-build-release - docker-publish-latest: requires: - docker-build-release From d05aa95a9b03dace30e6aeee57067ffd85f02965 Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 19:35:56 +0800 Subject: [PATCH 04/16] ci(finalize): exec tail in docker --- .circleci/config.yml | 4 ++-- js/finalize/index.ts | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b38aca030f..f11d3de423 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -171,7 +171,7 @@ jobs: && yarn start docker-run-finalize: executor: test-executor - description: Build and run e2e tests + description: Build and run finalization tests steps: - attach_workspace: at: /tmp/workspace @@ -185,7 +185,7 @@ jobs: git submodule update --init docker build -f docker/launch.Dockerfile -t launch . - run: - name: Run e2e tests + name: Run finalization tests command: | sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | sudo bash \ && source ~/.bashrc \ diff --git a/js/finalize/index.ts b/js/finalize/index.ts index 46946fcc08..b0cc2192be 100644 --- a/js/finalize/index.ts +++ b/js/finalize/index.ts @@ -1,6 +1,7 @@ /** * Test the finalization of parachain intergration */ +import fs from "fs"; import path from "path"; import { Launch } from "@pint/e2e/src"; import findUp from "find-up"; @@ -34,15 +35,26 @@ async function tail( file: string, match: (s: string) => boolean ): Promise { + const root = await findUp("Cargo.toml"); + return new Promise(async (resolve) => { - const ps = spawn("tail", ["-f", file], { - cwd: path.resolve(String(await findUp("Cargo.toml")), ".."), - stdio: "pipe", - }); + const ps = fs.existsSync(path.resolve(String(root), "../bin/pint")) + ? spawn("tail", ["-f", file], { + cwd: path.resolve(String(root), ".."), + stdio: "pipe", + }) + : spawn("docker", ["exec", `tail -f ${file}`, "-it", "launch"], { + stdio: "pipe", + }); ps.stdout.on("data", (chunk: Buffer) => { chunk && match(chunk.toString()) && resolve(null); }); + + ps.stderr.on("data", (chunk: Buffer) => { + process.stderr.write(chunk); + process.exit(1); + }); }); } From 4e9a5020dbb9d8e209067ebc8331fc816795c7fc Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 19:54:05 +0800 Subject: [PATCH 05/16] ci(finalize): reverse the docker command in finalization tests --- js/finalize/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/finalize/index.ts b/js/finalize/index.ts index b0cc2192be..bf3a9c5dad 100644 --- a/js/finalize/index.ts +++ b/js/finalize/index.ts @@ -43,7 +43,7 @@ async function tail( cwd: path.resolve(String(root), ".."), stdio: "pipe", }) - : spawn("docker", ["exec", `tail -f ${file}`, "-it", "launch"], { + : spawn("docker", ["exec", "-it", "launch", `tail -f ${file}`], { stdio: "pipe", }); From ac1c40eb74faab0f05986fef93c9d5a9eb092d71 Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 21:00:48 +0800 Subject: [PATCH 06/16] ci(docker): launch with container name --- docker/launch.Dockerfile | 4 ++-- js/e2e/src/launch.ts | 2 ++ js/finalize/index.ts | 10 +++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docker/launch.Dockerfile b/docker/launch.Dockerfile index b1d0c94800..53d0ddf7d3 100644 --- a/docker/launch.Dockerfile +++ b/docker/launch.Dockerfile @@ -5,7 +5,7 @@ # # This Dockerfile builds the environment of e2e tests FROM debian:buster-slim -COPY config.json config.json +COPY config.json launch/config.json COPY js/polkadot-launch polkadot-launch COPY --from=chainsafe/pint /usr/local/bin/pint bin/ COPY --from=clearloop/rococo-v1 /polkadot bin/ @@ -21,4 +21,4 @@ RUN apt-get update -y \ && npm install \ && npm run build EXPOSE 9988 -ENTRYPOINT [ "node", "polkadot-launch/dist/index.js", "config.json" ] +ENTRYPOINT [ "node", "polkadot-launch/dist/index.js", "launch/config.json" ] diff --git a/js/e2e/src/launch.ts b/js/e2e/src/launch.ts index 33403351bd..ec822aa6f6 100644 --- a/js/e2e/src/launch.ts +++ b/js/e2e/src/launch.ts @@ -32,6 +32,8 @@ export async function docker(stdio?: StdioOptions): Promise { [ "docker", "run", + "--name", + "launch", "-p", "9988:9988", "-p", diff --git a/js/finalize/index.ts b/js/finalize/index.ts index bf3a9c5dad..a72f803fea 100644 --- a/js/finalize/index.ts +++ b/js/finalize/index.ts @@ -43,9 +43,13 @@ async function tail( cwd: path.resolve(String(root), ".."), stdio: "pipe", }) - : spawn("docker", ["exec", "-it", "launch", `tail -f ${file}`], { - stdio: "pipe", - }); + : spawn( + "docker", + ["exec", "-it", "launch", "tail", "-f", `${file}`], + { + stdio: "pipe", + } + ); ps.stdout.on("data", (chunk: Buffer) => { chunk && match(chunk.toString()) && resolve(null); From a51ac8880ceebfa88163555b167e5ffa446c4d33 Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 21:15:57 +0800 Subject: [PATCH 07/16] ci(docker): get back the config.json path --- docker/launch.Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/launch.Dockerfile b/docker/launch.Dockerfile index 53d0ddf7d3..b1d0c94800 100644 --- a/docker/launch.Dockerfile +++ b/docker/launch.Dockerfile @@ -5,7 +5,7 @@ # # This Dockerfile builds the environment of e2e tests FROM debian:buster-slim -COPY config.json launch/config.json +COPY config.json config.json COPY js/polkadot-launch polkadot-launch COPY --from=chainsafe/pint /usr/local/bin/pint bin/ COPY --from=clearloop/rococo-v1 /polkadot bin/ @@ -21,4 +21,4 @@ RUN apt-get update -y \ && npm install \ && npm run build EXPOSE 9988 -ENTRYPOINT [ "node", "polkadot-launch/dist/index.js", "launch/config.json" ] +ENTRYPOINT [ "node", "polkadot-launch/dist/index.js", "config.json" ] From 022cf3ed2a3636738cdca5092919599deb63220e Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 21:32:34 +0800 Subject: [PATCH 08/16] ci(docker): remove the tty flag in docker arguemtns --- js/finalize/index.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/js/finalize/index.ts b/js/finalize/index.ts index a72f803fea..6407ad4ade 100644 --- a/js/finalize/index.ts +++ b/js/finalize/index.ts @@ -43,13 +43,9 @@ async function tail( cwd: path.resolve(String(root), ".."), stdio: "pipe", }) - : spawn( - "docker", - ["exec", "-it", "launch", "tail", "-f", `${file}`], - { - stdio: "pipe", - } - ); + : spawn("docker", ["exec", "launch", "tail", "-f", `${file}`], { + stdio: "pipe", + }); ps.stdout.on("data", (chunk: Buffer) => { chunk && match(chunk.toString()) && resolve(null); From 52559710e371fe57d694ea4269b2705e2b0f0680 Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 22:23:33 +0800 Subject: [PATCH 09/16] ci(docker): squash the launch scirpt of docker --- .circleci/config.yml | 65 +++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 40 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f11d3de423..0c07f4c2ec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,6 +22,27 @@ commands: sudo apt-get update \ && sudo apt-get install -y git clang curl libssl-dev \ && git config --global url."https://github.com/paritytech/".insteadOf https://github.com/paritytech// + prepare_launch_env: + steps: + - attach_workspace: + at: /tmp/workspace + - run: + name: Load Archived Docker Image + command: docker load -i /tmp/workspace/image.tar + - checkout + - run: + name: Build PINT launch Image + command: | + git submodule update --init + docker build -f docker/launch.Dockerfile -t launch . + - run: + name: Install Nodejs + command: | + sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | sudo bash \ + && source ~/.bashrc \ + && nvm install v15.9.0 \ + && nvm use v15.9.0 \ + && npm install yarn -g cargo_audit_setup: description: Install cargo-audit steps: @@ -147,54 +168,18 @@ jobs: executor: test-executor description: Build and run e2e tests steps: - - attach_workspace: - at: /tmp/workspace - - run: - name: Load Archived Docker Image - command: docker load -i /tmp/workspace/image.tar - - checkout - - run: - name: Build PINT launch Image - command: | - git submodule update --init - docker build -f docker/launch.Dockerfile -t launch . + - prepare_launch_env - run: name: Run e2e tests - command: | - sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | sudo bash \ - && source ~/.bashrc \ - && nvm install v15.9.0 \ - && nvm use v15.9.0 \ - && npm install yarn -g \ - && cd js/e2e \ - && yarn \ - && yarn start + command: cd js/e2e && yarn && yarn start docker-run-finalize: executor: test-executor description: Build and run finalization tests steps: - - attach_workspace: - at: /tmp/workspace - - run: - name: Load Archived Docker Image - command: docker load -i /tmp/workspace/image.tar - - checkout - - run: - name: Build PINT launch Image - command: | - git submodule update --init - docker build -f docker/launch.Dockerfile -t launch . + - prepare_launch_env - run: name: Run finalization tests - command: | - sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | sudo bash \ - && source ~/.bashrc \ - && nvm install v15.9.0 \ - && nvm use v15.9.0 \ - && npm install yarn -g \ - && cd js/finalize \ - && yarn \ - && yarn start + command: cd js/finalize && yarn && yarn start docker-publish-latest: executor: test-executor description: Publish latest Docker Image From 26e89ecbd9803b1fe1824b603bf73e6c23b1eafc Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 22:50:23 +0800 Subject: [PATCH 10/16] ci(node): source .bashrc after installing nodejs --- .circleci/config.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0c07f4c2ec..998cf4d345 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,7 +39,6 @@ commands: name: Install Nodejs command: | sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | sudo bash \ - && source ~/.bashrc \ && nvm install v15.9.0 \ && nvm use v15.9.0 \ && npm install yarn -g @@ -171,7 +170,7 @@ jobs: - prepare_launch_env - run: name: Run e2e tests - command: cd js/e2e && yarn && yarn start + command: source ~/.bashrc && cd js/e2e && yarn && yarn start docker-run-finalize: executor: test-executor description: Build and run finalization tests @@ -179,7 +178,7 @@ jobs: - prepare_launch_env - run: name: Run finalization tests - command: cd js/finalize && yarn && yarn start + command: source ~/.bashrc && cd js/finalize && yarn && yarn start docker-publish-latest: executor: test-executor description: Publish latest Docker Image From b8c6753acaa2875c68a95d170ab647d8be4ccf17 Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 23:26:41 +0800 Subject: [PATCH 11/16] ci(nodejs): source nvm from root --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 998cf4d345..c831d6f79b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -170,7 +170,7 @@ jobs: - prepare_launch_env - run: name: Run e2e tests - command: source ~/.bashrc && cd js/e2e && yarn && yarn start + command: source /root/.bashrc && cd js/e2e && yarn && yarn start docker-run-finalize: executor: test-executor description: Build and run finalization tests @@ -178,7 +178,7 @@ jobs: - prepare_launch_env - run: name: Run finalization tests - command: source ~/.bashrc && cd js/finalize && yarn && yarn start + command: source /root/.bashrc && cd js/finalize && yarn && yarn start docker-publish-latest: executor: test-executor description: Publish latest Docker Image From 65591bc5bea55a890762293a3a5e0068f25e5108 Mon Sep 17 00:00:00 2001 From: clearloop Date: Wed, 30 Jun 2021 23:48:07 +0800 Subject: [PATCH 12/16] ci(nodejs): sudo source nvm --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c831d6f79b..a80895186b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -170,7 +170,7 @@ jobs: - prepare_launch_env - run: name: Run e2e tests - command: source /root/.bashrc && cd js/e2e && yarn && yarn start + command: sudo source /root/.bashrc && cd js/e2e && yarn && yarn start docker-run-finalize: executor: test-executor description: Build and run finalization tests @@ -178,7 +178,7 @@ jobs: - prepare_launch_env - run: name: Run finalization tests - command: source /root/.bashrc && cd js/finalize && yarn && yarn start + command: sudo source /root/.bashrc && cd js/finalize && yarn && yarn start docker-publish-latest: executor: test-executor description: Publish latest Docker Image From fd3a89aa632030206b4ca035aa73a9244dae6518 Mon Sep 17 00:00:00 2001 From: clearloop Date: Thu, 1 Jul 2021 01:13:24 +0800 Subject: [PATCH 13/16] feat(nodejs): sudo -s prefix --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a80895186b..0363c00b99 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -170,7 +170,7 @@ jobs: - prepare_launch_env - run: name: Run e2e tests - command: sudo source /root/.bashrc && cd js/e2e && yarn && yarn start + command: sudo -s && source /root/.bashrc && cd js/e2e && yarn && yarn start docker-run-finalize: executor: test-executor description: Build and run finalization tests @@ -178,7 +178,7 @@ jobs: - prepare_launch_env - run: name: Run finalization tests - command: sudo source /root/.bashrc && cd js/finalize && yarn && yarn start + command: sudo -s && source /root/.bashrc && cd js/finalize && yarn && yarn start docker-publish-latest: executor: test-executor description: Publish latest Docker Image From 2fa09c321744cc049038ca39e1104a33e36c5fad Mon Sep 17 00:00:00 2001 From: clearloop Date: Thu, 1 Jul 2021 02:14:14 +0800 Subject: [PATCH 14/16] ci(sudo): seperate sudo command --- .circleci/config.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0363c00b99..eb3b995d25 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -170,7 +170,9 @@ jobs: - prepare_launch_env - run: name: Run e2e tests - command: sudo -s && source /root/.bashrc && cd js/e2e && yarn && yarn start + command: | + sudo -s + source /root/.bashrc && cd js/e2e && yarn && yarn start docker-run-finalize: executor: test-executor description: Build and run finalization tests @@ -178,7 +180,9 @@ jobs: - prepare_launch_env - run: name: Run finalization tests - command: sudo -s && source /root/.bashrc && cd js/finalize && yarn && yarn start + command: | + sudo -s + source /root/.bashrc && cd js/e2e && yarn && yarn start docker-publish-latest: executor: test-executor description: Publish latest Docker Image From 49c74cb68667e0f91b5df5765ee57e7f3dba017c Mon Sep 17 00:00:00 2001 From: clearloop Date: Thu, 1 Jul 2021 06:17:06 +0800 Subject: [PATCH 15/16] ci(finalize): seperate back... --- .circleci/config.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eb3b995d25..31163eb612 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,13 +35,6 @@ commands: command: | git submodule update --init docker build -f docker/launch.Dockerfile -t launch . - - run: - name: Install Nodejs - command: | - sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | sudo bash \ - && nvm install v15.9.0 \ - && nvm use v15.9.0 \ - && npm install yarn -g cargo_audit_setup: description: Install cargo-audit steps: @@ -171,8 +164,12 @@ jobs: - run: name: Run e2e tests command: | - sudo -s - source /root/.bashrc && cd js/e2e && yarn && yarn start + sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | \ + sudo bash \ + && nvm install v15.9.0 \ + && nvm use v15.9.0 \ + && npm install yarn -g \ + cd js/e2e && yarn && yarn start docker-run-finalize: executor: test-executor description: Build and run finalization tests @@ -181,8 +178,12 @@ jobs: - run: name: Run finalization tests command: | - sudo -s - source /root/.bashrc && cd js/e2e && yarn && yarn start + sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | \ + sudo bash \ + && nvm install v15.9.0 \ + && nvm use v15.9.0 \ + && npm install yarn -g \ + && cd js/finalize && yarn && yarn start docker-publish-latest: executor: test-executor description: Publish latest Docker Image From a4357715455aafa1bf65d29d2c3c16c2efbfcd49 Mon Sep 17 00:00:00 2001 From: clearloop Date: Thu, 1 Jul 2021 15:01:38 +0800 Subject: [PATCH 16/16] ci(e2e): fix e2e script --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 31163eb612..9c9176b3e8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -169,7 +169,7 @@ jobs: && nvm install v15.9.0 \ && nvm use v15.9.0 \ && npm install yarn -g \ - cd js/e2e && yarn && yarn start + && cd js/e2e && yarn && yarn start docker-run-finalize: executor: test-executor description: Build and run finalization tests