From 6f2c1481b26d8582eaedeb34ff216cb99598d76a Mon Sep 17 00:00:00 2001 From: Jon Linklater-Johnson Date: Fri, 8 Jan 2016 18:59:48 +0000 Subject: [PATCH] Use 'git rev-parse HEAD` to capture the Git commit ID and make this available to the slug set-up If Git is not present or the project is not using Git a failure code from the command will result in undefined being returned and the commit will not be set on the slug which is what currently happens. --- commands/release.js | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/commands/release.js b/commands/release.js index 754e78f..920c4b1 100644 --- a/commands/release.js +++ b/commands/release.js @@ -56,6 +56,15 @@ function release(context) { } } + function readCommit() { + return new Promise(function (fulfill, reject) { + child.execFile('git', ['rev-parse', 'HEAD'], function (error, stdout) { + if (error) { return fulfill(); } + return fulfill(stdout.trim()); + }); + }); + } + function readRemoteAddons() { return app.addons().list(); } @@ -135,15 +144,19 @@ function release(context) { } function createRemoteSlug(slug) { - var lang = `heroku-docker (${ slug.name || 'unknown'})`; - cli.log(`creating remote slug...`); - cli.log(`language-pack: ${ lang }`); - cli.log('remote process types:', modifiedProc); - var slugInfo = app.slugs().create({ - process_types: modifiedProc, - buildpack_provided_description: lang + return readCommit().then(commit => { + var lang = `heroku-docker (${ slug.name || 'unknown'})`; + cli.log(`creating remote slug...`); + cli.log(`language-pack: ${ lang }`); + cli.log('remote process types:', modifiedProc); + cli.log('commit id:', commit); + var slugInfo = app.slugs().create({ + process_types: modifiedProc, + buildpack_provided_description: lang, + commit + }); + return Promise.all([slug.path, slugInfo]) }); - return Promise.all([slug.path, slugInfo]) } function uploadSlug(slug) {