fix: properly write to triton create

This commit is contained in:
Sérgio Ramos 2017-05-31 11:46:58 +01:00
parent e2245dd9c0
commit 52a5a4b932

View File

@ -16,7 +16,9 @@ const ROOT = path.join(__dirname, '..');
const LOG = console.log; const LOG = console.log;
const createTritonProfile = async ({ SDC_ACCOUNT = '', SDC_KEY_ID = '' }) => { const createTritonProfile = async ({ SDC_ACCOUNT = '', SDC_KEY_ID = '' }) => {
LOG(`${figures.arrowRight} create triton profile SDC_ACCOUNT=${SDC_ACCOUNT.length} SDC_KEY_ID=${SDC_KEY_ID.length}`); LOG(
`${figures.arrowRight} create triton profile SDC_ACCOUNT=${SDC_ACCOUNT.length} SDC_KEY_ID=${SDC_KEY_ID.length}`
);
const payload = JSON.stringify({ const payload = JSON.stringify({
url: 'https://eu-ams-1.api.joyent.com', url: 'https://eu-ams-1.api.joyent.com',
@ -26,9 +28,12 @@ const createTritonProfile = async ({ SDC_ACCOUNT = '', SDC_KEY_ID = '' }) => {
curr: true curr: true
}); });
const cp = execa('triton', ['profile', 'create', '-f', '-']); const cp = execa('triton', ['profile', 'create', '-f', '-'], {
input: payload
});
cp.stdin.write(payload); cp.stdout.pipe(process.stdout);
cp.stderr.pipe(process.stderr);
return cp; return cp;
}; };
@ -47,15 +52,19 @@ const login = ({
_DOCKER_REGISTRY _DOCKER_REGISTRY
}) => async () => { }) => async () => {
LOG(`${figures.arrowRight} login`); LOG(`${figures.arrowRight} login`);
return execa('docker', [ return execa(
'login', 'docker',
'--email="."', [
`--username="${_DOCKER_LOGIN_USERNAME}"`, 'login',
`--password="${_DOCKER_LOGIN_PASSWORD}"`, '--email="."',
_DOCKER_REGISTRY `--username="${_DOCKER_LOGIN_USERNAME}"`,
], { `--password="${_DOCKER_LOGIN_PASSWORD}"`,
stdio: 'inherit' _DOCKER_REGISTRY
}); ],
{
stdio: 'inherit'
}
);
}; };
const build = ({ CIRCLE_BRANCH }) => async () => { const build = ({ CIRCLE_BRANCH }) => async () => {
@ -117,7 +126,7 @@ const run = async () => {
LOG(`${figures.arrowRight} .env`); LOG(`${figures.arrowRight} .env`);
LOG(JSON.stringify(Object.keys(env), null, 2)); LOG(JSON.stringify(Object.keys(env), null, 2));
return series([login(env), build(env), logout(env), deploy(env)]); // return series([login(env), build(env), logout(env), deploy(env)]);
}; };
LOG(`${figures.arrowRight} DEPLOY`); LOG(`${figures.arrowRight} DEPLOY`);