@leverege/build-tools 2.58.0-pedro.3 → 2.58.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.58.
|
|
3
|
+
"version": "2.58.1",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"pkglint": "src/pkglint.sh",
|
|
49
49
|
"prune-git": "src/prune-git.sh",
|
|
50
50
|
"pull-git": "src/pull-git.sh",
|
|
51
|
-
"push-model-registry": "src/push-model-registry.mjs",
|
|
52
51
|
"push-my-chart": "src/push-my-chart.mjs",
|
|
53
52
|
"refresh-npm-token": "src/refresh-npm-token.mjs",
|
|
54
53
|
"refresh-py-idx": "src/refresh-py-idx.sh",
|
|
@@ -60,7 +59,6 @@
|
|
|
60
59
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
61
60
|
"dependencies": {
|
|
62
61
|
"@google-cloud/artifact-registry": "^3.5.0",
|
|
63
|
-
"@google-cloud/storage": "^7.14.0",
|
|
64
62
|
"ansi-colors": "^4.1.3",
|
|
65
63
|
"chalk": "^5.3.0",
|
|
66
64
|
"command-line-args": "^6.0.1",
|
|
@@ -68,7 +66,6 @@
|
|
|
68
66
|
"deepmerge": "^4.3.1",
|
|
69
67
|
"enquirer": "^2.4.1",
|
|
70
68
|
"execa": "^9.5.1",
|
|
71
|
-
"fast-crc32c": "^2.0.0",
|
|
72
69
|
"glob": "^11.0.0",
|
|
73
70
|
"handlebars": "^4.7.8",
|
|
74
71
|
"inquirer": "^12.1.0",
|
|
@@ -85,6 +82,6 @@
|
|
|
85
82
|
},
|
|
86
83
|
"devDependencies": {
|
|
87
84
|
"@leverege/eslint-config-leverege": "^5.0.1",
|
|
88
|
-
"npm": "^10.9.
|
|
85
|
+
"npm": "^10.9.2"
|
|
89
86
|
}
|
|
90
|
-
}
|
|
87
|
+
}
|
package/src/Docker.mjs
CHANGED
|
@@ -183,9 +183,11 @@ const setPreviousBuild = ( version ) => {
|
|
|
183
183
|
fs.writeFileSync( previousFile, version )
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
const generateDockerfile = (
|
|
186
|
+
const generateDockerfile = ( options ) => {
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
const settings = { ...defaultSettings, ...options }
|
|
189
|
+
|
|
190
|
+
log( { settings }, chalk.green.bold( 'Validating the docker structure\n' ) )
|
|
189
191
|
|
|
190
192
|
// Ensure the presence of the docker dir with plugin and bashrc - this code
|
|
191
193
|
// could probably be tightened up a little.
|
package/src/Utils.mjs
CHANGED
|
@@ -237,7 +237,10 @@ https://console.cloud.google.com/artifacts/browse/leverege-registry?project=leve
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
// DEPRECATED: leverege.nodeimg
|
|
240
|
-
|
|
240
|
+
//
|
|
241
|
+
// NOTE: added nodeimg support back in but leaving this here and disabled
|
|
242
|
+
// by checking for xnodeimg vice nodeimg - still not sure we're keeping
|
|
243
|
+
if ( packageJson?.leverege?.xnodeimg ) {
|
|
241
244
|
const removeLine = `"nodeimg": "${packageJson.leverege.nodeimg}",`
|
|
242
245
|
|
|
243
246
|
const deprecationError = 'leverege.nodeimg is no longer supported'
|
|
@@ -94,7 +94,10 @@ if ( semver.lt( semver.coerce( repoDescr.buildToolsVersion ), minimumBuildToolsV
|
|
|
94
94
|
errorExit( `Error: package.json @leverege/build-tools minimum version is ^${minimumBuildToolsVersion}` )
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
const dockerInfo = await docker.generateDockerfile(
|
|
97
|
+
const dockerInfo = await docker.generateDockerfile( {
|
|
98
|
+
regvers : repoDescr.packageVersion,
|
|
99
|
+
nodeimage : repoDescr.closestPackageJson.leverege?.nodeimg, // left as nodeimg in package.json for backwards compat
|
|
100
|
+
} )
|
|
98
101
|
debug( { dockerInfo }, '<==The Docker Info' )
|
|
99
102
|
|
|
100
103
|
const {
|
|
@@ -51,12 +51,21 @@ spec:
|
|
|
51
51
|
for: 1m
|
|
52
52
|
labels:
|
|
53
53
|
severity: warning
|
|
54
|
-
|
|
54
|
+
# - alert: DatabaseDeadlockConflicts (original)
|
|
55
|
+
# annotations:
|
|
56
|
+
# description: There are over 10 deadlock conflicts in {{ $labels.pod }}
|
|
57
|
+
# summary: Checks the number of database conflicts
|
|
58
|
+
# expr: |-
|
|
59
|
+
# cnpg_pg_stat_database_deadlocks > 10
|
|
60
|
+
# for: 1m
|
|
61
|
+
# labels:
|
|
62
|
+
# severity: warning
|
|
63
|
+
- alert: DatabaseDeadlockConflicts
|
|
55
64
|
annotations:
|
|
56
|
-
description:
|
|
65
|
+
description: deadlocks are occurring {{ $labels.pod }}
|
|
57
66
|
summary: Checks the number of database conflicts
|
|
58
67
|
expr: |-
|
|
59
|
-
cnpg_pg_stat_database_deadlocks >
|
|
68
|
+
rate(cnpg_pg_stat_database_deadlocks[5m]) > 0
|
|
60
69
|
for: 1m
|
|
61
70
|
labels:
|
|
62
71
|
severity: warning
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
import inquirer from 'inquirer';
|
|
7
|
-
import {Storage} from '@google-cloud/storage';
|
|
8
|
-
import crc32c from 'fast-crc32c';
|
|
9
|
-
|
|
10
|
-
const storage = new Storage();
|
|
11
|
-
|
|
12
|
-
function getAllFiles(dirPath, arrayOfFiles = []) {
|
|
13
|
-
const files = fs.readdirSync(dirPath);
|
|
14
|
-
|
|
15
|
-
files.forEach(file => {
|
|
16
|
-
const filePath = path.join(dirPath, file);
|
|
17
|
-
if (fs.lstatSync(filePath).isDirectory()) {
|
|
18
|
-
arrayOfFiles = getAllFiles(filePath, arrayOfFiles);
|
|
19
|
-
} else {
|
|
20
|
-
arrayOfFiles.push(filePath);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return arrayOfFiles;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async function main() {
|
|
28
|
-
// Get git branch name
|
|
29
|
-
const branchName = fs.readFileSync('.git/HEAD', 'utf8').split('/').pop().trim();
|
|
30
|
-
|
|
31
|
-
const bucketName = `${branchName}-triton-model-registry`;
|
|
32
|
-
|
|
33
|
-
// Get all blobs in the bucket
|
|
34
|
-
let files = [];
|
|
35
|
-
try {
|
|
36
|
-
[files] = await storage.bucket(bucketName).getFiles();
|
|
37
|
-
} catch (error) {
|
|
38
|
-
if (error.code === 404) {
|
|
39
|
-
console.error(`Bucket ${bucketName} does not exist.`);
|
|
40
|
-
return;
|
|
41
|
-
} else {
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Get all not hidden blobs in the current path in the filesystem
|
|
47
|
-
const localFiles = getAllFiles('./models').filter(file => !path.basename(file).startsWith('.'));
|
|
48
|
-
|
|
49
|
-
const filesToDelete = files.filter(file => !localFiles.find(localFile => localFile === file.name));
|
|
50
|
-
|
|
51
|
-
console.log(`${chalk.underline(filesToDelete.length + " file(s)")} in ${chalk.underline(bucketName)} without a ${chalk.underline("local")} counterpart`);
|
|
52
|
-
filesToDelete.forEach(file => console.log(chalk.red(file.name)));
|
|
53
|
-
|
|
54
|
-
if (filesToDelete.length > 0) console.log("");
|
|
55
|
-
|
|
56
|
-
const filesToAdd = [];
|
|
57
|
-
const filesToReplace = [];
|
|
58
|
-
|
|
59
|
-
const metadataPromises = localFiles.map(async file => {
|
|
60
|
-
const localFileChecksum = Buffer.from(crc32c.calculate(fs.readFileSync(file)).toString(16), 'hex').toString('base64');
|
|
61
|
-
const remoteFile = files.find(blob => blob.name === file);
|
|
62
|
-
if (remoteFile) {
|
|
63
|
-
const [metadata] = await remoteFile.getMetadata();
|
|
64
|
-
return { file, localFileChecksum, remoteFileChecksum: metadata.crc32c };
|
|
65
|
-
} else {
|
|
66
|
-
return { file, localFileChecksum, remoteFileChecksum: null };
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const metadataResults = await Promise.all(metadataPromises);
|
|
71
|
-
|
|
72
|
-
metadataResults.forEach(({ file, localFileChecksum, remoteFileChecksum }) => {
|
|
73
|
-
if (remoteFileChecksum) {
|
|
74
|
-
if (localFileChecksum !== remoteFileChecksum) {
|
|
75
|
-
filesToReplace.push(file);
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
filesToAdd.push(file);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
console.log(`${chalk.underline(filesToAdd.length + " file(s)")} to be added to ${chalk.underline(bucketName)}`);
|
|
83
|
-
filesToAdd.forEach(file => console.log(chalk.green(file)));
|
|
84
|
-
|
|
85
|
-
if (filesToAdd.length > 0) console.log("");
|
|
86
|
-
|
|
87
|
-
console.log(`${chalk.underline(filesToReplace.length + " file(s)")} to be replaced in ${chalk.underline(bucketName)}`);
|
|
88
|
-
filesToReplace.forEach(file => console.log(chalk.yellow(file)));
|
|
89
|
-
|
|
90
|
-
if (filesToReplace.length > 0) console.log("");
|
|
91
|
-
|
|
92
|
-
if (filesToDelete.length > 0) {
|
|
93
|
-
const {confirm} = await inquirer.prompt({
|
|
94
|
-
type: 'confirm',
|
|
95
|
-
name: 'confirm',
|
|
96
|
-
message: `Do you want to delete ${filesToDelete.length} file(s) from ${bucketName}?`,
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
if (!confirm) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Remove all blobs that are not in the local filesystem
|
|
104
|
-
const deletePromises = filesToDelete.map(async file => {
|
|
105
|
-
console.log(`Deleting ${file.name} from ${bucketName}`);
|
|
106
|
-
return storage.bucket(bucketName).file(file.name).delete();
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
await Promise.all(deletePromises);
|
|
110
|
-
console.log("")
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (filesToAdd.length > 0 || filesToReplace.length > 0) {
|
|
114
|
-
const {confirm} = await inquirer.prompt({
|
|
115
|
-
type: 'confirm',
|
|
116
|
-
name: 'confirm',
|
|
117
|
-
message: `Do you want to upload ${filesToAdd.length + filesToReplace.length} file(s) to ${bucketName}?`,
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
if (!confirm) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Upload all new files
|
|
125
|
-
const uploadPromises = filesToAdd.map(async file => {
|
|
126
|
-
console.log(`Uploading ${file} to ${bucketName}`);
|
|
127
|
-
return storage.bucket(bucketName).upload(file, {
|
|
128
|
-
destination: file,
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
// Replace all files with different checksums
|
|
133
|
-
const replacePromises = filesToReplace.map(async file => {
|
|
134
|
-
console.log(`Replacing ${file} in ${bucketName}`);
|
|
135
|
-
return storage.bucket(bucketName).upload(file, {
|
|
136
|
-
destination: file,
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
await Promise.all([...uploadPromises, ...replacePromises]);
|
|
141
|
-
console.log("")
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
main().catch(console.error);
|