From 6e236fe59d91f5e03df9d65e865e893179db05ee Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 24 Sep 2020 20:21:04 +0200 Subject: [PATCH 1/2] Take the password from stdin Signed-off-by: CrazyMax --- dist/index.js | 9 +++++---- src/docker.ts | 4 ++-- src/exec.ts | 10 ++++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index 70629c9..b2f0948 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2908,12 +2908,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", { value: true }); exports.exec = void 0; const actionsExec = __importStar(__webpack_require__(514)); -exports.exec = (command, args = [], silent) => __awaiter(void 0, void 0, void 0, function* () { +exports.exec = (command, args = [], silent, stdin) => __awaiter(void 0, void 0, void 0, function* () { let stdout = ''; let stderr = ''; const options = { silent: silent, - ignoreReturnCode: true + ignoreReturnCode: true, + input: Buffer.from(stdin || '') }; options.listeners = { stdout: (data) => { @@ -2995,7 +2996,7 @@ function logout(registry) { exports.logout = logout; function loginStandard(registry, username, password) { return __awaiter(this, void 0, void 0, function* () { - let loginArgs = ['login', '--password', password]; + let loginArgs = ['login', '--password-stdin']; if (username) { loginArgs.push('--username', username); } @@ -3006,7 +3007,7 @@ function loginStandard(registry, username, password) { else { core.info(`🔑 Logging into DockerHub...`); } - yield execm.exec('docker', loginArgs, true).then(res => { + yield execm.exec('docker', loginArgs, true, password).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } diff --git a/src/docker.ts b/src/docker.ts index d276cbe..369666f 100644 --- a/src/docker.ts +++ b/src/docker.ts @@ -19,7 +19,7 @@ export async function logout(registry: string): Promise { } export async function loginStandard(registry: string, username: string, password: string): Promise { - let loginArgs: Array = ['login', '--password', password]; + let loginArgs: Array = ['login', '--password-stdin']; if (username) { loginArgs.push('--username', username); } @@ -30,7 +30,7 @@ export async function loginStandard(registry: string, username: string, password } else { core.info(`🔑 Logging into DockerHub...`); } - await execm.exec('docker', loginArgs, true).then(res => { + await execm.exec('docker', loginArgs, true, password).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } diff --git a/src/exec.ts b/src/exec.ts index 9ae09ca..f01d22d 100644 --- a/src/exec.ts +++ b/src/exec.ts @@ -7,13 +7,19 @@ export interface ExecResult { stderr: string; } -export const exec = async (command: string, args: string[] = [], silent: boolean): Promise => { +export const exec = async ( + command: string, + args: string[] = [], + silent: boolean, + stdin?: string +): Promise => { let stdout: string = ''; let stderr: string = ''; const options: ExecOptions = { silent: silent, - ignoreReturnCode: true + ignoreReturnCode: true, + input: Buffer.from(stdin || '') }; options.listeners = { stdout: (data: Buffer) => { From b7800fe6fdbaacb8fbadbfafcb43bba7f470bbc1 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 24 Sep 2020 20:24:09 +0200 Subject: [PATCH 2/2] Remove CHANGELOG (already available through GitHub Releases) Signed-off-by: CrazyMax --- CHANGELOG.md | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index bdf7bd3..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,30 +0,0 @@ -# Changelog - -## 1.3.0 (2020/08/21) - -* Handle AWS CLI v2 -* Check AWS CLI version -* Add tests -* Add example for Azure Container Registry (ACR) -* Move zeit/ncc to vercel/ncc - -## 1.2.0 (2020/08/20) - -* Add support for AWS Elastic Container Registry (ECR) -* Add example for Google Container Registry (GCR) - -## 1.1.1 (2020/08/16) - -* Typo - -## 1.1.0 (2020/08/15) - -* Add tests and examples for GitLab and GitHub Package Registry - -## 1.0.1 (2020/08/15) - -* Add LICENSE - -## 1.0.0 (2020/08/15) - -* Initial version