UNPKG

@codification/cutwater-build-aws

Version:
40 lines 2.26 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.EcrLoginTask = void 0; const AwsCliTask_1 = require("./AwsCliTask"); class EcrLoginTask extends AwsCliTask_1.AwsCliTask { constructor() { super('ecr-login', 'ecr', 'get-login-password'); } executeTask() { const _super = Object.create(null, { executeTask: { get: () => super.executeTask } }); var _a, _b, _c, _d; return __awaiter(this, void 0, void 0, function* () { if (!((_a = this.config.options) === null || _a === void 0 ? void 0 : _a.region)) { throw new Error('Region option must be provided.'); } if (!((_b = this.config.parameters) === null || _b === void 0 ? void 0 : _b.accountId)) { throw new Error('accountId parameter must be provided.'); } yield _super.executeTask.call(this); if (this.output) { const password = this.output.toString('utf-8'); this.output = undefined; yield this.config.spawn.execute(Object.assign(Object.assign({ logger: this.logger() }, this.config.spawnOptions), { command: 'docker', args: `login --username AWS --password-stdin ${(_c = this.config.parameters) === null || _c === void 0 ? void 0 : _c.accountId}.dkr.ecr.${(_d = this.config.options) === null || _d === void 0 ? void 0 : _d.region}.amazonaws.com`, stdin: password })); } }); } } exports.EcrLoginTask = EcrLoginTask; //# sourceMappingURL=EcrLoginTask.js.map