Skip to content

Commit

Permalink
fix: remote action inf loop when concurrency is 0 (#55)
Browse files Browse the repository at this point in the history
* fix: using cache

* fix: remote action in inf loop when concurrency is 0
  • Loading branch information
sirily11 authored Mar 28, 2022
1 parent a23d046 commit 991b971
Show file tree
Hide file tree
Showing 16 changed files with 23,307 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: "16"
cache: "yarn"
- run: yarn install
- run: yarn build
- name: Authenticate with Registry
Expand Down Expand Up @@ -51,6 +52,7 @@ jobs:
with:
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'
cache: "yarn"
- run: yarn
- run: yarn build
- run: yarn release --no-verify-access
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: "16"
cache: "yarn"
- run: yarn
- name: Run linters
uses: wearerequired/lint-action@v1
Expand All @@ -30,7 +31,7 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: "16"

cache: "yarn"
- run: yarn install
- run: yarn build
- run: yarn coverage
Expand All @@ -48,6 +49,7 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: "16"
cache: "yarn"
- run: yarn install
- run: yarn build
- name: Setup git identity
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules
.idea
.DS_Store
*.lock
coverage
*.log
dist
Expand Down
8 changes: 8 additions & 0 deletions packages/etd-common/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


typescript@^4.5.4:
version "4.5.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8"
integrity sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==
2,840 changes: 2,840 additions & 0 deletions packages/etd-docker-plan/yarn.lock

Large diffs are not rendered by default.

2,514 changes: 2,514 additions & 0 deletions packages/etd-history/yarn.lock

Large diffs are not rendered by default.

2,514 changes: 2,514 additions & 0 deletions packages/etd-logger/yarn.lock

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions packages/etd-next-js-handlers/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


typescript@^4.5.4:
version "4.5.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8"
integrity sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==
1 change: 1 addition & 0 deletions packages/etd-remote-action/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ yarn.lock
*.zip
!jest.config.js
src/schemas/*.json
src/main.ts
4 changes: 2 additions & 2 deletions packages/etd-remote-action/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"chalk": "^4.1.1",
"cli-progress": "^3.9.0",
"moment": "^2.29.1",
"node-ssh": "^12.0.0",
"node-ssh": "12.0.4",
"yaml": "^1.10.2"
},
"scripts": {
"start": "ts-node src/example.ts",
"start": "ts-node src/main.ts",
"prebuild": "ts-node src/generate.ts",
"dev": "ts-node-dev --respawn --transpile-only src/index.ts",
"test": "jest",
Expand Down
2 changes: 1 addition & 1 deletion packages/etd-remote-action/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class ConfigParser {
}
this.checkAndFixConfig();
Logger.info("Starting job " + this.config.name);
let concurrency = this.config.concurrency ?? 1;
let concurrency = Math.max(this.config.concurrency ?? 1, 1);
// Perform deep copy
let remoteAddresses: string[] = JSON.parse(
JSON.stringify(this.config.remote)
Expand Down
23 changes: 23 additions & 0 deletions packages/etd-remote-action/src/tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@ jest.mock("node-ssh", () => {
};
});

test("Simple test with concurrency 0", async () => {
let config = new ConfigParser({ filePath: "/", concurrency: 3 });

config.config = {
logger: undefined,
login: { username: "user", password: "pass" },
name: "Test",
output: false,
concurrency: 0,
steps: [
{
name: "My Command",
run: "ls",
},
],
remote: ["1", "2"],
};

let results = await config.runRemoteCommand({});
expect(results?.length).toBe(2);
expect(results![0][0].type).toBe("command");
});

test("Simple test with concurrency 1", async () => {
let config = new ConfigParser({ filePath: "/", concurrency: 3 });

Expand Down
Loading

0 comments on commit 991b971

Please sign in to comment.