forked from mekomsolutions/openmrs-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdistribution.js
66 lines (54 loc) · 1.76 KB
/
distribution.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"use strict";
const fs = require("fs");
const path = require("path");
const log = require("npmlog");
const XML = require("pixl-xml");
const _ = require("lodash");
const model = require("../../utils/model");
const utils = require("../../utils/utils");
const cst = require("../../const");
const config = require(cst.CONFIGPATH);
const db = require(cst.DBPATH);
const cmns = require("../commons");
const thisType = "distribution";
const nexusType = "openmrsmodule"; // for now we park distributions artifacts in the same place as OpenMRS modules on Nexus
module.exports = {
getInstance: function() {
var projectBuild = new model.ProjectBuild();
projectBuild.getBuildScript = function() {
return cmns.getMavenProjectBuildScript(thisType);
};
projectBuild.getDeployScript = function(artifact) {
return cmns.getMavenProjectDeployScript(
thisType,
"ARTIFACT_UPLOAD_URL_" + nexusType
);
};
projectBuild.getArtifact = function(args) {
return cmns.getMavenProjectArtifact(args.pom, "./target", "zip");
};
projectBuild.postBuildActions = function(args) {
var artifactKey = utils.toArtifactKey(
args.pom.groupId,
args.pom.artifactId,
args.pom.version
);
// Saving/updating the list of dependencies in the database.
db.saveArtifactDependencies(
artifactKey,
utils.parseDependencies(args.pom)
);
// Keeping track of the params of the latest built job (so, the current one).
db.saveArtifactBuildParams(
artifactKey,
utils.getBuildParams(process.env, config)
);
cmns.mavenPostBuildActions(
args.pom.groupId,
args.artifactsIds,
args.pom.version
);
};
return projectBuild;
}
};