Auto-merge for PR #815 via VersionBot

Build/deploy commands improvements
This commit is contained in:
resin-io-versionbot[bot] 2018-03-20 10:43:31 +00:00 committed by GitHub
commit ba82b1fa27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 25 deletions

View File

@ -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! automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/). 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 ## v7.0.5 - 2018-03-15
* Add bash completions #801 [Ronald McCollam] * Add bash completions #801 [Ronald McCollam]

View File

@ -63,7 +63,7 @@ createProject = (composePath, composeStr, projectName = null) ->
# generate an image name based on the project and service names # generate an image name based on the project and service names
# if one is not given and the service requires a build # if one is not given and the service requires a build
if descr.image.context? and not descr.image.tag? 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 descr
return { return {
path: composePath, path: composePath,
@ -188,7 +188,7 @@ exports.buildProject = (
# multibuild parses the composition internally so any tags we've # multibuild parses the composition internally so any tags we've
# set before are lost; re-assign them here # 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? if d.image.context?
d.image.tag = task.tag d.image.tag = task.tag
@ -225,6 +225,7 @@ exports.buildProject = (
task.progressHook = pullProgressAdapter(captureStream) task.progressHook = pullProgressAdapter(captureStream)
else else
task.streamHook = (stream) -> task.streamHook = (stream) ->
stream = createLogStream(stream)
if qemuPath? if qemuPath?
buildThroughStream = transpose.getBuildThroughStream buildThroughStream = transpose.getBuildThroughStream
hostQemuPath: toPosixPath(qemuPath) hostQemuPath: toPosixPath(qemuPath)
@ -236,6 +237,7 @@ exports.buildProject = (
# where we're given objects. capture these strings as they come # where we're given objects. capture these strings as they come
# before we parse them. # before we parse them.
rawStream rawStream
.pipe(dropEmptyLinesStream())
.pipe(captureStream) .pipe(captureStream)
.pipe(buildProgressAdapter(inlineLogs)) .pipe(buildProgressAdapter(inlineLogs))
.pipe(task.logStream) .pipe(task.logStream)
@ -440,13 +442,22 @@ pushProgressRenderer = (tty, prefix) ->
tty.clearLine() tty.clearLine()
return fn 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) -> buildLogCapture = (objectMode, buffer) ->
_ = require('lodash')
through = require('through2') through = require('through2')
through { objectMode }, (data, enc, cb) -> through { objectMode }, (data, enc, cb) ->
return cb(null, data) if not data?
# data from pull stream # data from pull stream
if data.error if data.error
buffer.push("#{data.error}") buffer.push("#{data.error}")
@ -457,30 +468,14 @@ buildLogCapture = (objectMode, buffer) ->
# data from build stream # data from build stream
else else
# normalise build log output here. it is somewhat ugly buffer.push(data)
# 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()
cb(null, data) cb(null, data)
buildProgressAdapter = (inline) -> buildProgressAdapter = (inline) ->
through = require('through2') through = require('through2')
stepRegex = /^\s*Step\s+(\d+)\/(\d+)\s*:\s+(.+)$/ stepRegex = /^\s*Step\s+(\d+)\/(\d+)\s*: (.+)$/
[ step, numSteps, progress ] = [ null, null, undefined ] [ step, numSteps, progress ] = [ null, null, undefined ]
@ -495,7 +490,7 @@ buildProgressAdapter = (inline) ->
else else
if (match = stepRegex.exec(str)) if (match = stepRegex.exec(str))
step = match[1] step = match[1]
numSteps = match[2] numSteps ?= match[2]
str = match[3] str = match[3]
if step? if step?
str = "Step #{step}/#{numSteps}: #{str}" str = "Step #{step}/#{numSteps}: #{str}"

View File

@ -1,6 +1,6 @@
{ {
"name": "resin-cli", "name": "resin-cli",
"version": "7.0.5", "version": "7.0.6",
"description": "The official resin.io CLI tool", "description": "The official resin.io CLI tool",
"main": "./build/actions/index.js", "main": "./build/actions/index.js",
"homepage": "https://github.com/resin-io/resin-cli", "homepage": "https://github.com/resin-io/resin-cli",
@ -148,8 +148,10 @@
"rimraf": "^2.4.3", "rimraf": "^2.4.3",
"rindle": "^1.0.0", "rindle": "^1.0.0",
"semver": "^5.3.0", "semver": "^5.3.0",
"split": "^1.0.1",
"stream-to-promise": "^2.2.0", "stream-to-promise": "^2.2.0",
"string-width": "^2.1.1", "string-width": "^2.1.1",
"strip-ansi-stream": "^1.0.0",
"through2": "^2.0.3", "through2": "^2.0.3",
"tmp": "0.0.31", "tmp": "0.0.31",
"umount": "^1.1.6", "umount": "^1.1.6",