Implemented release ZIP creation

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 11 years ago
parent 2485a8925e
commit fef5873728
  1. 1
      BuildServer/app.js
  2. 3
      BuildServer/package.json
  3. 1
      BuildServer/routes/index.js
  4. 25
      BuildServer/routes/release.js
  5. 3
      BuildServer/views/status.jade

@ -42,6 +42,7 @@ app.get('/manual', routes.manual.get);
app.post('/manual', routes.manual.post); app.post('/manual', routes.manual.post);
app.get('/status/:owner/:reponame/:branch/:rev?', routes.status.page); app.get('/status/:owner/:reponame/:branch/:rev?', routes.status.page);
app.get('/status.svg', routes.status.image); app.get('/status.svg', routes.status.image);
app.get('/release/:owner/:reponame/:branch/:rev', routes.release);
app.get('/artifact/:owner/:reponame/:branch/:rev/*', routes.artifact); app.get('/artifact/:owner/:reponame/:branch/:rev/*', routes.artifact);
http.createServer(app).listen(app.get('port'), function(){ http.createServer(app).listen(app.get('port'), function(){

@ -14,6 +14,7 @@
"request": "~2.27.0", "request": "~2.27.0",
"glob": "~3.2.7", "glob": "~3.2.7",
"nodemailer": "~0.6.0", "nodemailer": "~0.6.0",
"mustache": "~0.8.1" "mustache": "~0.8.1",
"adm-zip": "~0.4.4"
} }
} }

@ -11,3 +11,4 @@ exports.postreceive = require('./postreceive');
exports.manual = require('./manual'); exports.manual = require('./manual');
exports.status = require('./status'); exports.status = require('./status');
exports.artifact = require('./artifact'); exports.artifact = require('./artifact');
exports.release = require('./release');

@ -0,0 +1,25 @@
"use strict";
var path = require('path');
var Zip = require('adm-zip');
module.exports = function(req, res, next) {
var options = {
owner: req.params.owner,
reponame: req.params.reponame,
branchName: req.params.branch,
branch: "/refs/heads/" + req.params.branch,
rev: req.params.rev
};
var zip = new Zip(),
releasePath = path.normalize(req.app.get('releasepath') + "/" + options.owner + "/" + options.reponame + "/" + options.branch + "/" + options.rev + "/");
zip.addLocalFolder(releasePath);
zip.toBuffer(function (buffer) {
res.attachment(options.reponame + '.' + options.rev + '.zip', '.');
res.send(buffer);
}, function (error) {
next(error);
}, function () { }, function () { });
};

@ -24,6 +24,9 @@ block content
if file[file.length-1] != "/" if file[file.length-1] != "/"
li li
a(href="/artifact/" + [owner, reponame, branchName, rev, file].join("/")) #{file} a(href="/artifact/" + [owner, reponame, branchName, rev, file].join("/")) #{file}
p: b: a(href="/release/" + [owner, reponame, branchName, rev].join("/")) Download all artifacts as ZIP
if (report && report.result && report.result.messages && report.result.messages.$allMessages) if (report && report.result && report.result.messages && report.result.messages.$allMessages)
h2 Build output h2 Build output
pre pre

Loading…
Cancel
Save