提交 c7af7741 编写于 作者: NoSubject's avatar NoSubject

Merge branch 'fix/modify_Jenkinsfile' into 'develop'

Merge of fix/modify_Jenkinsfile to develop

See merge request o2oa/o2oa!72
......@@ -56,6 +56,8 @@ command.swap
**/bin/
**/src/main/webapp/describe/
**/target/
/target/**
/o2server/servers/
#ignore folder
version.o2
......@@ -149,4 +151,4 @@ typings/
.dynamodb/
#vscode
.factorypath
\ No newline at end of file
.factorypath
......@@ -3,19 +3,27 @@ pipeline {
stages {
stage('preperation') {
steps {
catchError {
sh 'target/o2server/stop_linux.sh'
}
sh 'npm install'
sh 'npm run preperation:linux'
sh 'npm run clear'
}
}
stage('build server') {
steps {
sh 'id'
sh 'npm run build_server'
}
}
stage('build web') {
steps {
sh 'npm run build_web'
stage('build') {
parallel {
stage('build server') {
steps {
sh 'id'
sh 'npm run build_server'
}
}
stage('build web') {
steps {
sh 'npm run build_web'
}
}
}
}
stage('deploy') {
......@@ -26,7 +34,7 @@ pipeline {
}
stage('run') {
steps {
sh 'target/o2server/start_linux.sh'
sh 'JENKINS_NODE_COOKIE=dontKillMe nohup target/o2server/start_linux.sh > nohup.out &'
}
}
}
......
var gulp = require('gulp'),
gutil = require('gulp-util'),
del = require('del'),
fs = require("fs"),
minimist = require('minimist'),
targz = require('targz'),
......@@ -7,7 +8,13 @@ var gulp = require('gulp'),
dateFormat = require('dateformat'),
progress = require('progress-stream'),
request = require("request"),
uglify = require('gulp-tm-uglify'),
rename = require('gulp-rename'),
changed = require('gulp-changed'),
gulpif = require('gulp-if'),
http = require('http');
var fg = require('fast-glob');
var logger = require('gulp-logger');
//var downloadHost = "download.o2oa.net";
var downloadHost = "release.o2oa.net";
......@@ -149,6 +156,9 @@ function initProgress(){
function download_commons_and_jvm(cb){
gutil.log(gutil.colors.green("begin download commons and jvm"));
console.log(`---------------------------------------------------------------------
. Start to download the dependencies needed for compilation ...
---------------------------------------------------------------------`);
var downloader = new Promise((resolve, reject) => {
var commonLoaded = false;
var jvmLoaded = false;
......@@ -184,6 +194,9 @@ function download_commons_and_jvm(cb){
}
function decompress_commons_and_jvm(cb){
console.log(`---------------------------------------------------------------------
. Start to decompress the dependencies needed for compilation ...
---------------------------------------------------------------------`);
gutil.log(gutil.colors.green("begin decompress commons and jvm"));
var count =0;
var decompressor = new Promise((resolve, reject) => {
......@@ -231,173 +244,91 @@ function decompress_commons_and_jvm(cb){
});
}
function getFileCount(p){
var fileCount = 0;
function readFile(path,filesList, ){
files = fs.readdirSync(path);
files.forEach(walk);
function walk(file){
states = fs.statSync(path+'/'+file);
if(states.isDirectory()){
readFile(path+'/'+file,filesList);
}else{
// fileCount+=states.size;
fileCount++;
}
}
}
var filesList = [];
readFile(p, filesList);
return fileCount;
}
function build_web_minimize(cb) {
console.log(`---------------------------------------------------------------------
. Start compiling the web ...
---------------------------------------------------------------------`);
var dest = 'target/o2server/webServer/';
var src_min = ['o2web/source/**/*.js', '!**/*.spec.js', '!**/test/**', '!o2web/source/o2_lib/**/*'];
function deploy_web(){
var path = "o2server/servers/"
var fileCount = getFileCount(path);
var entries = fg.sync(src_min, { dot: false});
var size = entries.length;
//console.log(fileCount);
var pb = new ProgressBar('', 50);
var progressStream = progress({
length: fileCount,
time: 100,
objectMode: true
});
progressStream.on('progress', function (stats) {
var n = (fileCount*stats.percentage/100).toFixed(0);
if (n>fileCount) n = fileCount;
pb.render({ completed: n, total: fileCount, count: n});
});
var source = "o2server/servers/**/*";
var dest = "target/o2server/servers/"
return gulp.src(source)
.pipe(progressStream)
var pb = new ProgressBar('total: '+size, 50);
var doCount = 0;
return gulp.src(src_min)
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest(dest))
.pipe(logger(function(){
if (doCount <= size){doCount++; pb.render({ completed: doCount, total: size, count: doCount})};
if (doCount > size) {console.log();}
}))
.pipe(gutil.noop());
}
function deploy_server_store(){
var path = "o2server/store/"
var fileCount = getFileCount(path);
var pb = new ProgressBar('total: '+fileCount, 50);
var progressStream = progress({
length: fileCount,
time: 100,
objectMode: true
});
progressStream.on('progress', function (stats) {
var n = (fileCount*stats.percentage/100).toFixed(0);
if (n>fileCount) n = fileCount;
pb.render({ completed: n, total: fileCount, count: n});
});
var source = "o2server/store/**/*";
var dest = "target/o2server/store/"
return gulp.src(source)
.pipe(progressStream)
.pipe(gulp.dest(dest))
.pipe(gutil.noop());
}
function deploy_server_commons(){
var path = "o2server/commons/"
var fileCount = getFileCount(path);
var pb = new ProgressBar('total: '+fileCount, 50);
var progressStream = progress({
length: fileCount,
time: 100,
objectMode: true
});
progressStream.on('progress', function (stats) {
var n = (fileCount*stats.percentage/100).toFixed(0);
if (n>fileCount) n = fileCount;
pb.render({ completed: n, total: fileCount, count: n});
});
function build_web_move() {
var dest = 'target/o2server/webServer/';
var src_move = ['o2web/source/**/*', '!**/*.spec.js', '!**/test/**'];
var source = "o2server/commons/**/*";
var dest = "target/o2server/commons/"
return gulp.src(source)
.pipe(progressStream)
.pipe(gulp.dest(dest))
.pipe(gutil.noop());
}
function deploy_server_jvm(){
var path = "o2server/jvm/"
var fileCount = getFileCount(path);
var pb = new ProgressBar('total: '+fileCount, 50);
var progressStream = progress({
length: fileCount,
time: 100,
objectMode: true
});
progressStream.on('progress', function (stats) {
var n = (fileCount*stats.percentage/100).toFixed(0);
if (n>fileCount) n = fileCount;
pb.render({ completed: n, total: fileCount, count: n});
});
var entries = fg.sync(src_move, { dot: false});
var size = entries.length;
var pb = new ProgressBar('total: '+size, 50);
var doCount = 0;
var source = "o2server/jvm/**/*";
var dest = "target/o2server/jvm/"
return gulp.src(source)
.pipe(progressStream)
return gulp.src(src_move)
.pipe(gulp.dest(dest))
.pipe(gutil.noop());
}
function deploy_server_config(){
var path = "o2server/configSample/"
var fileCount = getFileCount(path);
var pb = new ProgressBar('total: '+fileCount, 50);
var progressStream = progress({
length: fileCount,
time: 100,
objectMode: true
});
progressStream.on('progress', function (stats) {
var n = (fileCount*stats.percentage/100).toFixed(0);
if (n>fileCount) n = fileCount;
pb.render({ completed: n, total: fileCount, count: n});
});
.pipe(logger(function(){
var source = "o2server/configSample/**/*";
var dest = "target/o2server/configSample/"
return gulp.src(source)
.pipe(progressStream)
.pipe(gulp.dest(dest))
if (doCount <= size) {doCount++;pb.render({ completed: doCount, total: size, count: doCount})};
if (doCount > size) {console.log();}
}))
.pipe(gutil.noop());
}
function deploy_server_local(){
var path = "o2server/localSample/"
var fileCount = getFileCount(path);
var pb = new ProgressBar('total: '+fileCount, 50);
var progressStream = progress({
length: fileCount,
time: 100,
objectMode: true
});
progressStream.on('progress', function (stats) {
var n = (fileCount*stats.percentage/100).toFixed(0);
if (n>fileCount) n = fileCount;
pb.render({ completed: n, total: fileCount, count: n});
});
exports.build_web_move = build_web_move;
function clear_build(cb){
console.log(`---------------------------------------------------------------------
. clear old build ...
---------------------------------------------------------------------`);
var dest = 'target';
del(dest, { dryRun: true, force: true });
cb();
}
exports.clear_build = clear_build;
function deploy_server(){
console.log(`---------------------------------------------------------------------
. deploy to target ...
---------------------------------------------------------------------`);
var source1 = ["o2server/store/**/*", "o2server/commons/**/*", "o2server/jvm/**/*", "o2server/configSample/**/*", "o2server/localSample/**/*"];
source = source1.concat(scriptSource);
var dest = "target/o2server/servers/"
var entries = fg.sync(source, { dot: false});
var size = entries.length;
var pb = new ProgressBar('total: '+size, 50);
var doCount = 0;
var source = "o2server/localSample/**/*";
var dest = "target/o2server/localSample/"
return gulp.src(source)
.pipe(progressStream)
.pipe(gulp.dest(dest))
.pipe(gutil.noop());
}
function deploy_server_script(){
var dest = "target/o2server/"
return gulp.src(scriptSource)
.pipe(gulp.dest(dest))
.pipe(gutil.noop());
.pipe(logger(function(){
if (doCount <= size) {doCount++; pb.render({ completed: doCount, total: size, count: doCount})};
if (doCount > size) {console.log();}
}));
}
exports.preperation = gulp.series(download_commons_and_jvm, decompress_commons_and_jvm);
exports.preperation = gulp.series(download_commons_and_jvm, decompress_commons_and_jvm,);
exports.deploy = gulp.series(deploy_web, deploy_server_store, deploy_server_commons, deploy_server_jvm, deploy_server_config, deploy_server_local, deploy_server_script);
var shell = require('gulp-shell')
exports.build_server = function(){
console.log(`---------------------------------------------------------------------
. Start compiling the server ...
---------------------------------------------------------------------`);
return (shell.task('npm run build_server_script'))();
};
exports.build_web = gulp.series(build_web_minimize, build_web_move);
exports.deploy = deploy_server;
此差异已折叠。
{
"name": "o2oa_web",
"version": "1.1.7",
"description": "a javascript library",
"main": "o2.js",
"scripts": {
"build": "gulp",
"report-coverage": "codecov"
},
"repository": {
"type": "git",
"url": "git+https://github.com/huqi1980/o2oa_client_web.git"
},
"keywords": [
"oa",
"office",
"workflow",
"process",
"cms",
"bpm",
"portal"
],
"author": "Tommy-O2OA",
"license": "AGPL-3.0",
"bugs": {
"url": "https://github.com/huqi1980/o2oa_client_web/issues"
},
"homepage": "https://github.com/huqi1980/o2oa_client_web#readme",
"devDependencies": {
"gulp": "^4.0.0",
"gulp-tm-asset-rev": "0.0.16",
"gulp-changed": "^3.2.0",
"gulp-deleted": "0.0.2",
"gulp-ftp": "^1.1.0",
"gulp-if": "^2.0.2",
"gulp-rename": "^1.4.0",
"gulp-sftp": "^0.1.5",
"gulp-tm-uglify": "^3.0.1",
"merge-stream": "^1.0.1",
"minimist": "^1.2.0"
}
}
var dev = [
var apps = [
{ "folder": "o2_lib", "tasks": ["move"] },
{ "folder": "o2_core", "tasks": ["move", "min"] },
{ "folder": "x_component_ANN", "tasks": ["move", "min"] },
......@@ -86,4 +86,4 @@ var dev = [
{ "folder": "x_desktop", "tasks": ["move", "min"] },
];
module.exports = dev;
module.exports = apps;
......@@ -90,7 +90,7 @@ function getAppTask(path, isMin, thisOptions) {
port: option.port || 22,
remotePath: (option.remotePath || '/') + path
})))
.pipe(gulpif((option.ev == "dev") ,gulp.dest(dest)))
.pipe(gulpif((option.ev == "dev" || option.ev == "pro") ,gulp.dest(dest)))
.pipe(gulp.src(src_move))
.pipe(changed(dest))
......@@ -367,3 +367,16 @@ gulp.task("git_dest", function () {
gulp.task("git", gulp.series('git_clean', 'git_dest'));
gulp.task("default", gulp.series(gulp.parallel(appTasks, 'index'), "o2:new-v"));
function build(){
options.ev = "p";
options.upload = o_options.upload || "";
options.location = o_options.location || uploadOptions.location;
options.host = o_options.host || uploadOptions.host;
options.user = o_options.user || uploadOptions.user;
options.pass = o_options.pass || uploadOptions.pass;
options.port = o_options.port || uploadOptions.port;
options.remotePath = o_options.remotePath || uploadOptions.remotePath;
options.dest = o_options.dest || uploadOptions.dest || "dest";
};
gulp.task("build", gulp.series("clean", gulp.parallel(appTasks, 'index'), "o2:new-v"))
{
"name": "o2oa",
"version": "4.0.3763",
"description": "o2oa",
"main": "",
"scripts": {
"preperation": "gulp preperation",
"preperation:win": "gulp preperation --e windows",
"preperation:linux": "gulp preperation --e linux",
"preperation:aix": "gulp preperation --e aix",
"preperation:kylinos": "gulp preperation --e kylinos",
"preperation:macos": "gulp preperation --e macos",
"preperation:neokylin": "gulp preperation --e neokylin",
"preperation:rpi": "gulp preperation --e raspberrypi",
"name": "o2oa",
"version": "4.0.3763",
"description": "o2oa",
"main": "",
"scripts": {
"preperation": "gulp preperation",
"preperation:win": "gulp preperation --e windows",
"preperation:linux": "gulp preperation --e linux",
"preperation:aix": "gulp preperation --e aix",
"preperation:kylinos": "gulp preperation --e kylinos",
"preperation:macos": "gulp preperation --e macos",
"preperation:neokylin": "gulp preperation --e neokylin",
"preperation:rpi": "gulp preperation --e raspberrypi",
"build_server": "cd o2server && mvn clean && mvn install",
"build_web": "cd o2server && npm install && gulp",
"build_parallel": "npm run build_server & npm run build_web",
"build_server": "gulp build_server",
"build_server_script": "cd o2server && mvn clean && mvn install",
"build_web": "gulp build_web",
"build_parallel": "npm run build_web",
"deploy": "gulp deploy",
"deploy:win": "gulp deploy --e windows",
"deploy:linux": "gulp deploy --e linux",
"deploy:aix": "gulp deploy --e aix",
"deploy:kylinos": "gulp deploy --e kylinos",
"deploy:macos": "gulp deploy --e macos",
"deploy:neokylin": "gulp deploy --e neokylin",
"deploy:rpi": "gulp deploy --e raspberrypi",
"deploy": "gulp deploy",
"deploy:win": "gulp deploy --e windows",
"deploy:linux": "gulp deploy --e linux",
"deploy:aix": "gulp deploy --e aix",
"deploy:kylinos": "gulp deploy --e kylinos",
"deploy:macos": "gulp deploy --e macos",
"deploy:neokylin": "gulp deploy --e neokylin",
"deploy:rpi": "gulp deploy --e raspberrypi",
"typeInfor": "type welcome && echo Your server is build success: target/o2server/",
"typeInfor": "type welcome && echo Your server is build success: target/o2server/",
"clear": "gulp clear_build",
"build": "npm run preperation && npm run build_parallel && npm run deploy && npm run typeInfor",
"build:win": "npm run preperation:win && npm run build_parallel && npm run deploy:win && npm run typeInfor",
"build:linux": "npm run preperation:linux && npm run build_parallel && npm run deploy:linux && npm run typeInfor",
"build:aix": "npm run preperation:aix && npm run build_parallel && npm run deploy:aix && npm run typeInfor",
"build:kylinos": "npm run preperation:kylinos && npm run build_parallel && npm run deploy:kylinos && npm run typeInfor",
"build:macos": "npm run preperation:macos && npm run build_parallel && npm run deploy:macos && npm run typeInfor",
"build:neokylin": "npm run preperation:neokylin && npm run build_parallel && npm run deploy:neokylin && npm run typeInfor",
"build:rpi": "npm run preperation:rpi && npm run build_parallel && npm run deploy:rpi && npm run typeInfor",
"test": "type welcome"
},
"repository": {
"type": "git",
"url": "https://github.com/o2oa/o2oa.git"
},
"author": "",
"license": "ISC",
"dependencies": {
"dateformat": "^3.0.3",
"gulp": "^4.0.2",
"gulp-util": "^3.0.8",
"progress-stream": "^2.0.0",
"request": "^2.88.2",
"single-line-log": "^1.1.2",
"targz": "^1.0.1"
}
"build": "npm run clear && npm run preperation && npm run build_parallel && npm run deploy && npm run typeInfor",
"build:win": "npm run clear && npm run preperation:win && npm run build_parallel && npm run deploy:win && npm run typeInfor",
"build:linux": "npm run clear && npm run preperation:linux && npm run build_parallel && npm run deploy:linux && npm run typeInfor",
"build:aix": "npm run clear && npm run preperation:aix && npm run build_parallel && npm run deploy:aix && npm run typeInfor",
"build:kylinos": "npm run clear && npm run preperation:kylinos && npm run build_parallel && npm run deploy:kylinos && npm run typeInfor",
"build:macos": "npm run clear && npm run preperation:macos && npm run build_parallel && npm run deploy:macos && npm run typeInfor",
"build:neokylin": "npm run clear && npm run preperation:neokylin && npm run build_parallel && npm run deploy:neokylin && npm run typeInfor",
"build:rpi": "npm run clear && npm run preperation:rpi && npm run build_parallel && npm run deploy:rpi && npm run typeInfor",
"test": "type welcome"
},
"repository": {
"type": "git",
"url": "https://github.com/o2oa/o2oa.git"
},
"author": "",
"license": "ISC",
"dependencies": {
"dateformat": "^3.0.3",
"fast-glob": "^3.2.2",
"gulp": "^4.0.2",
"gulp-changed": "^3.2.0",
"gulp-deleted": "^1.0.0",
"gulp-if": "^2.0.2",
"gulp-logger": "0.0.2",
"gulp-rename": "^1.4.0",
"gulp-shell": "^0.8.0",
"gulp-tm-asset-rev": "0.0.16",
"gulp-tm-uglify": "3.0.1",
"gulp-util": "^3.0.8",
"minimist": "^1.2.0",
"progress-stream": "^2.0.0",
"request": "^2.88.2",
"single-line-log": "^1.1.2",
"targz": "^1.0.1"
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册