Implemented "skip git loader" option for manual builds

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 11 years ago
parent ace3f1e9c8
commit 1137e217c8
  1. 12
      BuildServer/lib/builder.js
  2. 3
      BuildServer/views/manual.jade

@ -37,13 +37,15 @@ var build = function (options, callback) {
reponame = options.reponame, reponame = options.reponame,
rev = options.rev, rev = options.rev,
branch = options.branch, branch = options.branch,
skipGitLoader = options.skipGitLoader,
local = options.app.get('gitpath') + "/" + owner + "/" + reponame + ".git", local = options.app.get('gitpath') + "/" + owner + "/" + reponame + ".git",
tmp = options.app.get('tmpcodepath') + "/" + rev, tmp = options.app.get('tmpcodepath') + "/" + rev,
exported = tmp + "/code", exported = tmp + "/code",
release = options.app.get('releasepath') + "/" + owner + "/" + reponame + "/" + branch + "/" + rev, release = options.app.get('releasepath') + "/" + owner + "/" + reponame + "/" + branch + "/" + rev,
statusQueue = async.queue(function (task, callback) { statusQueue = async.queue(function (task, callback) {
task(callback); task(callback);
}, 1); }, 1),
actualGitLoader = skipGitLoader ? function(options, callback) { process.nextTick(callback); } : gitLoader;
statusQueue.push(function (callback) { statusQueue.push(function (callback) {
notifyStatus({ notifyStatus({
@ -62,9 +64,9 @@ var build = function (options, callback) {
fs.writeFileSync(options.app.get('releasepath') + "/" + owner + "/" + reponame + "/$revs/" + rev + ".branch", branch); fs.writeFileSync(options.app.get('releasepath') + "/" + owner + "/" + reponame + "/$revs/" + rev + ".branch", branch);
var done = function (err, result) { var done = function (err, result) {
var errorMessage = result ? ((result.errors.$allMessages || [])[0] || {}).message : err, var errorMessage = result && result.errors ? ((result.errors.$allMessages || [])[0] || {}).message : err,
warnMessage = result ? ((result.warns.$allMessages || [])[0] || {}).message : err, warnMessage = result && result.warns ? ((result.warns.$allMessages || [])[0] || {}).message : err,
infoMessage = result ? ((result.infos.$allMessages || []).slice(-1)[0] || {}).message : err; infoMessage = result && result.infos ? ((result.infos.$allMessages || []).slice(-1)[0] || {}).message : err;
fs.writeFile(release + "/report.json", JSON.stringify({err: err, result: result}), function (writeErr) { fs.writeFile(release + "/report.json", JSON.stringify({err: err, result: result}), function (writeErr) {
statusQueue.push(function (callback) { statusQueue.push(function (callback) {
@ -84,7 +86,7 @@ var build = function (options, callback) {
}); });
}; };
gitLoader({ actualGitLoader({
remote: url + ".git", remote: url + ".git",
local: local, local: local,
branch: branch, branch: branch,

@ -20,5 +20,8 @@ block content
tr tr
td Branch td Branch
td: input(type="text", name="branch", value="refs/heads/master") td: input(type="text", name="branch", value="refs/heads/master")
tr
td Skip git loader?
td: input(type="checkbox", name="skipGitLoader")
tr tr
td(colspan=2): input(type="submit", value="submit") td(colspan=2): input(type="submit", value="submit")

Loading…
Cancel
Save