Skip to content
This repository was archived by the owner on Jun 6, 2023. It is now read-only.

Commit 969f8dc

Browse files
exdxsanfilip
authored andcommitted
WIP - needs error handling for io
WIP - needs error handling for io
1 parent 3e3663a commit 969f8dc

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lib/jobs/create.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var os = require('os');
99
var fs = require('fs');
1010
var archiver = require('archiver');
1111
var ProgressBar = require('progress');
12+
var child_process = require('child_process');
1213
var projectConfig = require('./../projectConfig');
1314
var jobs_logs = require('./../jobs/logs.js');
1415
var jobs_waitfor = require('./../jobs/waitfor.js');
@@ -260,6 +261,7 @@ function create(params, cb) {
260261
var jobId = res.id;
261262
console.log('New jobId: ' + res.id);
262263
console.log('Cluster: ' + res.cluster);
264+
if (res.codeCommit) console.log('Git commit: ' + res.codeCommit);
263265
console.log('Job ' + res.state);
264266
if (res.state === 'Pending') console.log('Waiting for job to run...');
265267
return jobs_waitfor({ jobId: jobId, state: 'Running' }, function _waitforCb(err, res) {
@@ -324,14 +326,17 @@ function create(params, cb) {
324326
//get git hash commit
325327
fs.stat(params.workspace + "/.git", function (err, stats) {
326328
if (err) {
327-
//exit - not a git repo
329+
//pass - not a git repo
330+
return
331+
}
332+
try {
333+
var revision = child_process.execSync('git rev-parse --short HEAD', {cwd:params.workspace})
334+
.toString().trim();
335+
} catch (error) {
336+
//pass - git issue
337+
return
328338
}
329-
console.log(params.workspace)
330-
var revision = require('child_process')
331-
.execSync('git rev-parse --short HEAD', {cwd:params.workspace})
332-
.toString().trim()
333339
params.codeCommit = revision
334-
console.log(params.codeCommit)
335340
})
336341

337342
// zip the workspace file if it is not already a zip file

0 commit comments

Comments
 (0)