mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-21 01:42:26 +00:00
Fix the not-enough-unicorns bug
Add successful build indicator in the form of a unicorn. Change-type: patch Signed-off-by: Cameron Diver <cameron@resin.io>
This commit is contained in:
parent
65eaad2ed5
commit
d249ac168a
@ -7,6 +7,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
- Add uploading of build logs when present with resin deploy
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed the not enough unicorns bug in resin build
|
||||
|
||||
## [5.9.1] - 2017-05-01
|
||||
|
||||
### Fixed
|
||||
|
@ -99,11 +99,12 @@ uploadLogs = function(logs, token, url, buildId, username, appName) {
|
||||
var request;
|
||||
request = require('request');
|
||||
return request.post({
|
||||
json: true,
|
||||
url: getBuilderLogPushEndpoint(url, buildId, username, appName),
|
||||
auth: {
|
||||
bearer: token
|
||||
},
|
||||
body: Buffer.from(logs).toString('base64')
|
||||
body: Buffer.from(logs)
|
||||
});
|
||||
};
|
||||
|
||||
@ -113,29 +114,31 @@ uploadToPromise = function(request, size, logStreams) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var handleMessage;
|
||||
handleMessage = function(data) {
|
||||
var e, obj;
|
||||
data = data.toString();
|
||||
logging.logDebug(logStreams, "Received data: " + data);
|
||||
return Promise["try"](function() {
|
||||
var obj;
|
||||
try {
|
||||
obj = JSON.parse(data);
|
||||
if (obj.type != null) {
|
||||
switch (obj.type) {
|
||||
case 'error':
|
||||
return reject(new Error("Remote error: " + obj.error));
|
||||
case 'success':
|
||||
return resolve(obj);
|
||||
case 'status':
|
||||
return logging.logInfo(logStreams, "Remote: " + obj.message);
|
||||
default:
|
||||
return reject(new Error("Received unexpected reply from remote: " + data));
|
||||
}
|
||||
} else {
|
||||
return reject(new Error("Received unexpected reply from remote: " + data));
|
||||
}
|
||||
})["catch"](function(e) {
|
||||
} catch (error) {
|
||||
e = error;
|
||||
logging.logError(logStreams, 'Error parsing reply from remote side');
|
||||
return reject(e);
|
||||
});
|
||||
reject(e);
|
||||
return;
|
||||
}
|
||||
if (obj.type != null) {
|
||||
switch (obj.type) {
|
||||
case 'error':
|
||||
return reject(new Error("Remote error: " + obj.error));
|
||||
case 'success':
|
||||
return resolve(obj);
|
||||
case 'status':
|
||||
return logging.logInfo(logStreams, "Remote: " + obj.message);
|
||||
default:
|
||||
return reject(new Error("Received unexpected reply from remote: " + data));
|
||||
}
|
||||
} else {
|
||||
return reject(new Error("Received unexpected reply from remote: " + data));
|
||||
}
|
||||
};
|
||||
request.on('error', reject).on('data', handleMessage);
|
||||
return pushProgress(size, request, logStreams);
|
||||
|
@ -99,11 +99,12 @@ exports.tarDirectory = tarDirectory = function(dir) {
|
||||
};
|
||||
|
||||
exports.runBuild = function(params, options, getBundleInfo, logStreams) {
|
||||
var Promise, dockerBuild, es, logging, logs, resolver;
|
||||
var Promise, dockerBuild, doodles, es, logging, logs, resolver;
|
||||
Promise = require('bluebird');
|
||||
dockerBuild = require('resin-docker-build');
|
||||
resolver = require('resin-bundle-resolve');
|
||||
es = require('event-stream');
|
||||
doodles = require('resin-doodles');
|
||||
logging = require('../utils/logging');
|
||||
if (params.source == null) {
|
||||
params.source = '.';
|
||||
@ -117,6 +118,9 @@ exports.runBuild = function(params, options, getBundleInfo, logStreams) {
|
||||
if (options.tag != null) {
|
||||
console.log("Tagging image as " + options.tag);
|
||||
}
|
||||
console.log();
|
||||
console.log(doodles.getDoodle());
|
||||
console.log();
|
||||
return resolve({
|
||||
image: image,
|
||||
log: logs
|
||||
|
@ -118,6 +118,7 @@ exports.runBuild = (params, options, getBundleInfo, logStreams) ->
|
||||
dockerBuild = require('resin-docker-build')
|
||||
resolver = require('resin-bundle-resolve')
|
||||
es = require('event-stream')
|
||||
doodles = require('resin-doodles')
|
||||
|
||||
logging = require('../utils/logging')
|
||||
|
||||
@ -133,7 +134,14 @@ exports.runBuild = (params, options, getBundleInfo, logStreams) ->
|
||||
buildSuccess: (image) ->
|
||||
if options.tag?
|
||||
console.log("Tagging image as #{options.tag}")
|
||||
# Show charlie. In the interest of cloud parity,
|
||||
# use console.log, not the standard logging streams
|
||||
console.log()
|
||||
console.log(doodles.getDoodle())
|
||||
console.log()
|
||||
|
||||
resolve({ image, log: logs } )
|
||||
|
||||
buildFailure: reject
|
||||
buildStream: (stream) ->
|
||||
getBundleInfo(options)
|
||||
|
@ -71,6 +71,7 @@
|
||||
"resin-device-config": "^3.0.0",
|
||||
"resin-device-init": "^2.2.1",
|
||||
"resin-docker-build": "^0.4.0",
|
||||
"resin-doodles": "0.0.1",
|
||||
"resin-image-fs": "^2.1.2",
|
||||
"resin-image-manager": "^4.1.1",
|
||||
"resin-sdk-preconfigured": "^6.0.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user