proceger 2.0.6 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/git.js +4 -0
- package/lib/task.js +9 -4
- package/package.json +1 -1
package/lib/git.js
CHANGED
|
@@ -27,6 +27,7 @@ class GitRepo {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
async init() {
|
|
30
|
+
let newRepo = false;
|
|
30
31
|
try {
|
|
31
32
|
await fs.readdir(this.#repoPath);
|
|
32
33
|
} catch (e) {
|
|
@@ -37,8 +38,11 @@ class GitRepo {
|
|
|
37
38
|
`Directory does not exist, cloning repostory from ${this.#url}.`);
|
|
38
39
|
await fs.mkdir(path.dirname(this.#repoPath), {recursive: true});
|
|
39
40
|
await git(path.dirname(this.#repoPath)).clone(this.#url);
|
|
41
|
+
newRepo = true;
|
|
40
42
|
}
|
|
41
43
|
this.#git = git(this.#repoPath);
|
|
44
|
+
this.#revision = await this.#git.revparse('HEAD');
|
|
45
|
+
return newRepo;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
async update() {
|
package/lib/task.js
CHANGED
|
@@ -47,6 +47,10 @@ class Task {
|
|
|
47
47
|
logger.info(`Task(${this.#name}): ${message}`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
logDebug(message) {
|
|
51
|
+
logger.debug(`Task(${this.#name}): ${message}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
updateStatus(status) {
|
|
51
55
|
this.logInfo(`Transisting from ${this.#status} to ${status}.`);
|
|
52
56
|
this.#status = status;
|
|
@@ -74,9 +78,10 @@ class Task {
|
|
|
74
78
|
async startImpl() {
|
|
75
79
|
this.updateStatus('STARTING');
|
|
76
80
|
this.logInfo(`Initializing git repository...`);
|
|
77
|
-
await this.#git.init();
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
const newRepo = await this.#git.init();
|
|
82
|
+
if (newRepo) {
|
|
83
|
+
await this.runCommand('npm ci', true);
|
|
84
|
+
}
|
|
80
85
|
if (this.#child !== null) {
|
|
81
86
|
kill(this.#child.pid);
|
|
82
87
|
this.#child = null;
|
|
@@ -155,7 +160,7 @@ class Task {
|
|
|
155
160
|
child.stdout.on('data', (data) => {
|
|
156
161
|
for (const line of data.toString().split('\n')) {
|
|
157
162
|
if (line) {
|
|
158
|
-
this.
|
|
163
|
+
this.logDebug(`${command} > ${line}`);
|
|
159
164
|
}
|
|
160
165
|
}
|
|
161
166
|
});
|