1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-13 06:40:06 +02:00

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 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({
url: 'https://eu-ams-1.api.joyent.com',
@ -26,9 +28,12 @@ const createTritonProfile = async ({ SDC_ACCOUNT = '', SDC_KEY_ID = '' }) => {
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;
};
@ -47,15 +52,19 @@ const login = ({
_DOCKER_REGISTRY
}) => async () => {
LOG(`${figures.arrowRight} login`);
return execa('docker', [
'login',
'--email="."',
`--username="${_DOCKER_LOGIN_USERNAME}"`,
`--password="${_DOCKER_LOGIN_PASSWORD}"`,
_DOCKER_REGISTRY
], {
stdio: 'inherit'
});
return execa(
'docker',
[
'login',
'--email="."',
`--username="${_DOCKER_LOGIN_USERNAME}"`,
`--password="${_DOCKER_LOGIN_PASSWORD}"`,
_DOCKER_REGISTRY
],
{
stdio: 'inherit'
}
);
};
const build = ({ CIRCLE_BRANCH }) => async () => {
@ -117,7 +126,7 @@ const run = async () => {
LOG(`${figures.arrowRight} .env`);
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`);