mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-22 06:57:48 +00:00
Auto-merge for PR #815 via VersionBot
Build/deploy commands improvements
This commit is contained in:
commit
ba82b1fa27
@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file
|
||||
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## v7.0.6 - 2018-03-20
|
||||
|
||||
* Make sure image name is all lowercase #815 [Akis Kesoglou]
|
||||
* Improve handling of build log output #815 [Akis Kesoglou]
|
||||
|
||||
## v7.0.5 - 2018-03-15
|
||||
|
||||
* Add bash completions #801 [Ronald McCollam]
|
||||
|
@ -63,7 +63,7 @@ createProject = (composePath, composeStr, projectName = null) ->
|
||||
# generate an image name based on the project and service names
|
||||
# if one is not given and the service requires a build
|
||||
if descr.image.context? and not descr.image.tag?
|
||||
descr.image.tag = [ projectName, descr.serviceName ].join('_')
|
||||
descr.image.tag = [ projectName, descr.serviceName ].join('_').toLowerCase()
|
||||
return descr
|
||||
return {
|
||||
path: composePath,
|
||||
@ -188,7 +188,7 @@ exports.buildProject = (
|
||||
|
||||
# multibuild parses the composition internally so any tags we've
|
||||
# set before are lost; re-assign them here
|
||||
task.tag ?= [ projectName, task.serviceName ].join('_')
|
||||
task.tag ?= [ projectName, task.serviceName ].join('_').toLowerCase()
|
||||
if d.image.context?
|
||||
d.image.tag = task.tag
|
||||
|
||||
@ -225,6 +225,7 @@ exports.buildProject = (
|
||||
task.progressHook = pullProgressAdapter(captureStream)
|
||||
else
|
||||
task.streamHook = (stream) ->
|
||||
stream = createLogStream(stream)
|
||||
if qemuPath?
|
||||
buildThroughStream = transpose.getBuildThroughStream
|
||||
hostQemuPath: toPosixPath(qemuPath)
|
||||
@ -236,6 +237,7 @@ exports.buildProject = (
|
||||
# where we're given objects. capture these strings as they come
|
||||
# before we parse them.
|
||||
rawStream
|
||||
.pipe(dropEmptyLinesStream())
|
||||
.pipe(captureStream)
|
||||
.pipe(buildProgressAdapter(inlineLogs))
|
||||
.pipe(task.logStream)
|
||||
@ -440,13 +442,22 @@ pushProgressRenderer = (tty, prefix) ->
|
||||
tty.clearLine()
|
||||
return fn
|
||||
|
||||
createLogStream = (input) ->
|
||||
split = require('split')
|
||||
stripAnsi = require('strip-ansi-stream')
|
||||
return input.pipe(stripAnsi()).pipe(split())
|
||||
|
||||
dropEmptyLinesStream = ->
|
||||
through = require('through2')
|
||||
through (data, enc, cb) ->
|
||||
str = data.toString('utf-8')
|
||||
@push(str) if str.trim()
|
||||
cb()
|
||||
|
||||
buildLogCapture = (objectMode, buffer) ->
|
||||
_ = require('lodash')
|
||||
through = require('through2')
|
||||
|
||||
through { objectMode }, (data, enc, cb) ->
|
||||
return cb(null, data) if not data?
|
||||
|
||||
# data from pull stream
|
||||
if data.error
|
||||
buffer.push("#{data.error}")
|
||||
@ -457,30 +468,14 @@ buildLogCapture = (objectMode, buffer) ->
|
||||
|
||||
# data from build stream
|
||||
else
|
||||
# normalise build log output here. it is somewhat ugly
|
||||
# that this supposedly "passthrough" stream mutates the
|
||||
# values before forwarding them, but it's convenient
|
||||
# as it allows to both forward and save normalised logs
|
||||
|
||||
# convert to string, split to lines, trim each one and
|
||||
# filter out empty ones.
|
||||
lines = _(data.toString('utf-8').split(/\r?\n$/))
|
||||
.map(_.trimEnd)
|
||||
.reject(_.isEmpty)
|
||||
|
||||
# forward each line separately
|
||||
lines.forEach (line) =>
|
||||
buffer.push(line)
|
||||
@push(line)
|
||||
|
||||
return cb()
|
||||
buffer.push(data)
|
||||
|
||||
cb(null, data)
|
||||
|
||||
buildProgressAdapter = (inline) ->
|
||||
through = require('through2')
|
||||
|
||||
stepRegex = /^\s*Step\s+(\d+)\/(\d+)\s*:\s+(.+)$/
|
||||
stepRegex = /^\s*Step\s+(\d+)\/(\d+)\s*: (.+)$/
|
||||
|
||||
[ step, numSteps, progress ] = [ null, null, undefined ]
|
||||
|
||||
@ -495,7 +490,7 @@ buildProgressAdapter = (inline) ->
|
||||
else
|
||||
if (match = stepRegex.exec(str))
|
||||
step = match[1]
|
||||
numSteps = match[2]
|
||||
numSteps ?= match[2]
|
||||
str = match[3]
|
||||
if step?
|
||||
str = "Step #{step}/#{numSteps}: #{str}"
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "resin-cli",
|
||||
"version": "7.0.5",
|
||||
"version": "7.0.6",
|
||||
"description": "The official resin.io CLI tool",
|
||||
"main": "./build/actions/index.js",
|
||||
"homepage": "https://github.com/resin-io/resin-cli",
|
||||
@ -148,8 +148,10 @@
|
||||
"rimraf": "^2.4.3",
|
||||
"rindle": "^1.0.0",
|
||||
"semver": "^5.3.0",
|
||||
"split": "^1.0.1",
|
||||
"stream-to-promise": "^2.2.0",
|
||||
"string-width": "^2.1.1",
|
||||
"strip-ansi-stream": "^1.0.0",
|
||||
"through2": "^2.0.3",
|
||||
"tmp": "0.0.31",
|
||||
"umount": "^1.1.6",
|
||||
|
Loading…
Reference in New Issue
Block a user