Merge pull request #1185 from balena-io/add-detached-logs-push

push: Add detached flag to avoid streaming logs after local push
This commit is contained in:
CameronDiver 2019-04-24 14:58:12 +01:00 committed by GitHub
commit b05aa7b385
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 3 deletions

View File

@ -1464,13 +1464,17 @@ Path to a local YAML or JSON file containing Docker registry passwords used to p
Note this feature is in beta.
Start a live session with the containers pushed to a local-mode device.
Start a live session with the containers pushed to a local mode device.
The project source folder is watched for filesystem events, and changes
to files and folders are automatically synchronized to the running
containers. The synchronisation is only in one direction, from this machine to
the device, and changes made on the device itself may be overwritten.
This feature requires a device running supervisor version v9.7.0 or greater.
#### --detached, -d
Don't tail application logs when pushing to a local mode device
# Settings
## settings

View File

@ -107,6 +107,7 @@ export const push: CommandDefinition<
nocache: boolean;
'registry-secrets': string;
live: boolean;
detached: boolean;
}
> = {
signature: 'push <applicationOrDevice>',
@ -184,13 +185,19 @@ export const push: CommandDefinition<
description: stripIndent`
Note this feature is in beta.
Start a live session with the containers pushed to a local-mode device.
Start a live session with the containers pushed to a local mode device.
The project source folder is watched for filesystem events, and changes
to files and folders are automatically synchronized to the running
containers. The synchronisation is only in one direction, from this machine to
the device, and changes made on the device itself may be overwritten.
This feature requires a device running supervisor version v9.7.0 or greater.`,
},
{
signature: 'detached',
alias: 'd',
description: `Don't tail application logs when pushing to a local mode device`,
boolean: true,
},
],
async action(params, options, done) {
const sdk = (await import('balena-sdk')).fromSharedOptions();
@ -230,7 +237,12 @@ export const push: CommandDefinition<
// Ensure that the live argument has not been passed to a cloud build
if (options.live) {
exitWithExpectedError(
'The --live flag is only valid when pushing to a local device.',
'The --live flag is only valid when pushing to a local mode device',
);
}
if (options.detached) {
exitWithExpectedError(
`The --detached flag is only valid when pushing to a local mode device.`,
);
}
@ -272,6 +284,7 @@ export const push: CommandDefinition<
registrySecrets,
nocache: options.nocache || false,
live: options.live || false,
detached: options.detached || false,
}),
)
.catch(BuildError, e => {

View File

@ -47,6 +47,7 @@ export interface DeviceDeployOptions {
registrySecrets: RegistrySecrets;
nocache: boolean;
live: boolean;
detached: boolean;
}
async function checkSource(source: string): Promise<boolean> {
@ -146,6 +147,9 @@ export async function deployToDevice(opts: DeviceDeployOptions): Promise<void> {
await api.setTargetState(targetState);
if (opts.detached) {
return;
}
// Print an empty newline to separate the build output
// from the device output
console.log();