v12 preparations: Add feature switch for build/deploy --logs option

Connects-to: #1770
Change-type: patch
This commit is contained in:
Paulo Castro 2020-06-02 16:42:51 +01:00
parent 21dd959344
commit 626d328194
3 changed files with 37 additions and 8 deletions

View File

@ -50,9 +50,21 @@ export function appendOptions(opts) {
},
{
signature: 'logs',
description: 'Display full log output',
description: isV12()
? 'No-op and deprecated since balena CLI v12.0.0. Build logs are now shown by default.'
: 'Display full log output',
boolean: true,
},
...(isV12()
? [
{
signature: 'nologs',
description:
'Hide the image build log output (produce less verbose output)',
boolean: true,
},
]
: []),
{
signature: 'nogitignore',
description: isV12()
@ -98,7 +110,7 @@ export function generateOpts(options) {
return fs.realpath(options.source || '.').then(projectPath => ({
projectName: options.projectName,
projectPath,
inlineLogs: !!options.logs,
inlineLogs: !options.nologs && (!!options.logs || isV12()),
dockerfilePath: options.dockerfile,
nogitignore: !!options.nogitignore || isV12(),
noParentCheck: options['noparent-check'],

View File

@ -24,6 +24,7 @@ import mock = require('mock-require');
import { fs } from 'mz';
import * as path from 'path';
import { isV12 } from '../../build/utils/version';
import { BalenaAPIMock } from '../balena-api-mock';
import { expectStreamNoCRLF, testDockerBuildStream } from '../docker-build';
import { DockerMock, dockerResponsePath } from '../docker-mock';
@ -98,7 +99,9 @@ describe('balena build', function() {
...commonResponseLines[responseFilename],
`[Info] No "docker-compose.yml" file found at "${projectPath}"`,
`[Info] Creating default composition with source: "${projectPath}"`,
'[Build] main Image size: 1.14 MB',
isV12()
? '[Build] main Step 1/4 : FROM busybox'
: '[Build] main Image size: 1.14 MB',
];
if (isWindows) {
expectedResponseLines.push(
@ -153,7 +156,9 @@ describe('balena build', function() {
`[Info] Creating default composition with source: "${projectPath}"`,
'[Info] Building for rpi/raspberry-pi',
'[Info] Emulation is enabled',
'[Build] main Image size: 1.14 MB',
isV12()
? '[Build] main Step 1/4 : FROM busybox'
: '[Build] main Image size: 1.14 MB',
'[Success] Build succeeded!',
];
if (isWindows) {
@ -223,7 +228,9 @@ describe('balena build', function() {
...commonResponseLines[responseFilename],
`[Info] No "docker-compose.yml" file found at "${projectPath}"`,
`[Info] Creating default composition with source: "${projectPath}"`,
'[Build] main Image size: 1.14 MB',
isV12()
? '[Build] main Step 1/4 : FROM busybox'
: '[Build] main Image size: 1.14 MB',
];
if (isWindows) {
expectedResponseLines.push(
@ -293,8 +300,15 @@ describe('balena build', function() {
};
const expectedResponseLines: string[] = [
...commonResponseLines[responseFilename],
`[Build] service1 Image size: 1.14 MB`,
`[Build] service2 Image size: 1.14 MB`,
...(isV12()
? [
'[Build] service1 Step 1/4 : FROM busybox',
'[Build] service2 Step 1/4 : FROM busybox',
]
: [
`[Build] service1 Image size: 1.14 MB`,
`[Build] service2 Image size: 1.14 MB`,
]),
];
if (isWindows) {
expectedResponseLines.push(

View File

@ -23,6 +23,7 @@ import { fs } from 'mz';
import * as path from 'path';
import * as sinon from 'sinon';
import { isV12 } from '../../build/utils/version';
import { BalenaAPIMock } from '../balena-api-mock';
import { testDockerBuildStream } from '../docker-build';
import { DockerMock, dockerResponsePath } from '../docker-mock';
@ -38,7 +39,9 @@ const commonResponseLines = {
'[Info] Docker Desktop detected (daemon architecture: "x86_64")',
'[Info] Docker itself will determine and enable architecture emulation if required,',
'[Info] without balena-cli intervention and regardless of the --emulated option.',
'[Build] main Image size: 1.14 MB',
isV12()
? '[Build] main Step 1/4 : FROM busybox'
: '[Build] main Image size: 1.14 MB',
'[Info] Creating release...',
'[Info] Pushing images to registry...',
'[Info] Saving release...',