From ea4bbbaa4f6241f629808d62053f87b76b6ec5ea Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 8 Sep 2021 22:20:06 +0800 Subject: [PATCH 1/3] ci: Add more version tests Signed-off-by: Xuanwo --- .github/workflows/test.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 27ae8bf..11ad1ad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - hdfs-version: [ "3.3.1" ] + hdfs-version: [ "2.10.1", "3.2.2", "3.3.0", "3.3.1" ] steps: - name: Checkout diff --git a/README.md b/README.md index c13ff00..54f6998 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ steps: ## Available versions - "2.10.1" -- "2.2.2" +- "3.2.2" - "3.3.0" - "3.3.1" From db6b1c1758090f43359661b39f4ec1f23bf05020 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 8 Sep 2021 22:28:31 +0800 Subject: [PATCH 2/3] Add set for secondary Signed-off-by: Xuanwo --- dist/index.js | 82 ++++++++++++++++++++++++++++++++++------------- src/setup-hdfs.ts | 5 +++ 2 files changed, 64 insertions(+), 23 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5fd29fd..e962cec 100644 --- a/dist/index.js +++ b/dist/index.js @@ -64,6 +64,10 @@ function setup() { dfs.replication 1 + + dfs.secondary.http.address + localhost:9100 + `; yield writeFile(`${hdfsFolder}/etc/hadoop/hdfs-site.xml`, hdfsSite); const hdfsHome = yield tool_cache_1.cacheDir(hdfsFolder, 'hdfs', hdfsVersion); @@ -247,7 +251,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; +exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; const command_1 = __nccwpck_require__(351); const file_command_1 = __nccwpck_require__(717); const utils_1 = __nccwpck_require__(278); @@ -425,19 +429,30 @@ exports.debug = debug; /** * Adds an error issue * @param message error issue message. Errors will be converted to string via toString() + * @param properties optional properties to add to the annotation. */ -function error(message) { - command_1.issue('error', message instanceof Error ? message.toString() : message); +function error(message, properties = {}) { + command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } exports.error = error; /** - * Adds an warning issue + * Adds a warning issue * @param message warning issue message. Errors will be converted to string via toString() + * @param properties optional properties to add to the annotation. */ -function warning(message) { - command_1.issue('warning', message instanceof Error ? message.toString() : message); +function warning(message, properties = {}) { + command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } exports.warning = warning; +/** + * Adds a notice issue + * @param message notice issue message. Errors will be converted to string via toString() + * @param properties optional properties to add to the annotation. + */ +function notice(message, properties = {}) { + command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); +} +exports.notice = notice; /** * Writes info to log with console.log. * @param message info message @@ -571,7 +586,7 @@ exports.issueCommand = issueCommand; // We use any as a valid input type /* eslint-disable @typescript-eslint/no-explicit-any */ Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.toCommandValue = void 0; +exports.toCommandProperties = exports.toCommandValue = void 0; /** * Sanitizes an input into a string so it can be passed into issueCommand safely * @param input input to sanitize into a string @@ -586,6 +601,25 @@ function toCommandValue(input) { return JSON.stringify(input); } exports.toCommandValue = toCommandValue; +/** + * + * @param annotationProperties + * @returns The command properties to send with the actual annotation command + * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 + */ +function toCommandProperties(annotationProperties) { + if (!Object.keys(annotationProperties).length) { + return {}; + } + return { + title: annotationProperties.title, + line: annotationProperties.startLine, + endLine: annotationProperties.endLine, + col: annotationProperties.startColumn, + endColumn: annotationProperties.endColumn + }; +} +exports.toCommandProperties = toCommandProperties; //# sourceMappingURL=utils.js.map /***/ }), @@ -5335,7 +5369,7 @@ module.exports = v4; /***/ ((module) => { "use strict"; -module.exports = require("assert");; +module.exports = require("assert"); /***/ }), @@ -5343,7 +5377,7 @@ module.exports = require("assert");; /***/ ((module) => { "use strict"; -module.exports = require("child_process");; +module.exports = require("child_process"); /***/ }), @@ -5351,7 +5385,7 @@ module.exports = require("child_process");; /***/ ((module) => { "use strict"; -module.exports = require("crypto");; +module.exports = require("crypto"); /***/ }), @@ -5359,7 +5393,7 @@ module.exports = require("crypto");; /***/ ((module) => { "use strict"; -module.exports = require("events");; +module.exports = require("events"); /***/ }), @@ -5367,7 +5401,7 @@ module.exports = require("events");; /***/ ((module) => { "use strict"; -module.exports = require("fs");; +module.exports = require("fs"); /***/ }), @@ -5375,7 +5409,7 @@ module.exports = require("fs");; /***/ ((module) => { "use strict"; -module.exports = require("http");; +module.exports = require("http"); /***/ }), @@ -5383,7 +5417,7 @@ module.exports = require("http");; /***/ ((module) => { "use strict"; -module.exports = require("https");; +module.exports = require("https"); /***/ }), @@ -5391,7 +5425,7 @@ module.exports = require("https");; /***/ ((module) => { "use strict"; -module.exports = require("net");; +module.exports = require("net"); /***/ }), @@ -5399,7 +5433,7 @@ module.exports = require("net");; /***/ ((module) => { "use strict"; -module.exports = require("os");; +module.exports = require("os"); /***/ }), @@ -5407,7 +5441,7 @@ module.exports = require("os");; /***/ ((module) => { "use strict"; -module.exports = require("path");; +module.exports = require("path"); /***/ }), @@ -5415,7 +5449,7 @@ module.exports = require("path");; /***/ ((module) => { "use strict"; -module.exports = require("stream");; +module.exports = require("stream"); /***/ }), @@ -5423,7 +5457,7 @@ module.exports = require("stream");; /***/ ((module) => { "use strict"; -module.exports = require("string_decoder");; +module.exports = require("string_decoder"); /***/ }), @@ -5431,7 +5465,7 @@ module.exports = require("string_decoder");; /***/ ((module) => { "use strict"; -module.exports = require("timers");; +module.exports = require("timers"); /***/ }), @@ -5439,7 +5473,7 @@ module.exports = require("timers");; /***/ ((module) => { "use strict"; -module.exports = require("tls");; +module.exports = require("tls"); /***/ }), @@ -5447,7 +5481,7 @@ module.exports = require("tls");; /***/ ((module) => { "use strict"; -module.exports = require("util");; +module.exports = require("util"); /***/ }) @@ -5486,7 +5520,9 @@ module.exports = require("util");; /************************************************************************/ /******/ /* webpack/runtime/compat */ /******/ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ +/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; +/******/ +/************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports diff --git a/src/setup-hdfs.ts b/src/setup-hdfs.ts index cc470a5..b1292d3 100644 --- a/src/setup-hdfs.ts +++ b/src/setup-hdfs.ts @@ -32,6 +32,10 @@ async function setup() { dfs.replication 1 + + dfs.secondary.http.address + localhost:9100 + `; await writeFile(`${hdfsFolder}/etc/hadoop/hdfs-site.xml`, hdfsSite); @@ -68,6 +72,7 @@ ssh-add ~/.ssh/id_rsa } } ); + exec( `${hdfsHome}/sbin/start-dfs.sh`, (err: any, stdout: any, stderr: any) => { From 1fcc8b37d4cae2a018d447f65b620eebee3100b1 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 8 Sep 2021 22:37:35 +0800 Subject: [PATCH 3/3] Fix host not verified Signed-off-by: Xuanwo --- dist/index.js | 4 +++- src/setup-hdfs.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index e962cec..c213513 100644 --- a/dist/index.js +++ b/dist/index.js @@ -73,11 +73,13 @@ function setup() { const hdfsHome = yield tool_cache_1.cacheDir(hdfsFolder, 'hdfs', hdfsVersion); // Setup self ssh connection. // Fix permission issues: https://github.community/t/ssh-test-using-github-action/166717/12 - const cmd = `chmod g-w $HOME && + const cmd = `chmod g-w $HOME && chmod o-w $HOME && ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys && +ssh-keyscan -H localhost >> ~/.ssh/known_hosts && +chmod 0600 ~/.ssh/known_hosts && eval \`ssh-agent\` && ssh-add ~/.ssh/id_rsa `; diff --git a/src/setup-hdfs.ts b/src/setup-hdfs.ts index b1292d3..f7ff7f8 100644 --- a/src/setup-hdfs.ts +++ b/src/setup-hdfs.ts @@ -43,11 +43,13 @@ async function setup() { // Setup self ssh connection. // Fix permission issues: https://github.community/t/ssh-test-using-github-action/166717/12 - const cmd = `chmod g-w $HOME && + const cmd = `chmod g-w $HOME && chmod o-w $HOME && ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys && +ssh-keyscan -H localhost >> ~/.ssh/known_hosts && +chmod 0600 ~/.ssh/known_hosts && eval \`ssh-agent\` && ssh-add ~/.ssh/id_rsa `;