Skip to content

Commit

Permalink
chore: Update build-upload script to use a single Docker build proces…
Browse files Browse the repository at this point in the history
…s. Fix S3 Client
  • Loading branch information
Huakun Shen committed May 26, 2024
1 parent a8b0f49 commit 63cb505
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ci/build-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ for (const extPath of extensionsCandidateFolders) {
/* -------------------------------------------------------------------------- */
/* Build All Extensions With Docker */
/* -------------------------------------------------------------------------- */
const PoolSize = 5;
const PoolSize = 1;
// split toBuildExt into chunks of PoolSize, run multiple docker builds in parallel
const toBuildExtChunks = [];
for (let i = 0; i < toBuildExt.length; i += PoolSize) {
Expand Down
13 changes: 12 additions & 1 deletion ci/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export function buildWithDocker(extPath: string): Promise<{
stderrTarballFilename: string;
pkg: ExtPackageJson;
}> {
console.log(`Building ${extPath}`);
return new Promise((resolve, reject) => {
const pkg = parsePackageJson(join(extPath, "package.json"));
// console.log(pkg);
Expand Down Expand Up @@ -149,6 +150,7 @@ export function buildWithDocker(extPath: string): Promise<{
console.log("Parsed shasum:", stderrShasum);
}
}

if (dataStr.includes("npm notice filename:")) {
const tarballFilename = dataStr.match(
/npm notice filename:\s+([^\s]+)/,
Expand All @@ -157,6 +159,14 @@ export function buildWithDocker(extPath: string): Promise<{
stderrTarballFilename = tarballFilename[1];
console.log("Parsed tarball:", stderrTarballFilename);
}
} else if (dataStr.includes("filename:")) {
const tarballFilename = dataStr.match(
/filename:\s+([^\s]+)/,
);
if (tarballFilename) {
stderrTarballFilename = tarballFilename[1];
console.log("Parsed tarball:", stderrTarballFilename);
}
}
// } else {
// console.error("data is not string");
Expand Down Expand Up @@ -243,6 +253,7 @@ export function uploadTarballToS3(
) {
const s3Client = new S3Client({
endpoint: z.string().parse(process.env.S3_ENDPOINT),
region: "auto",
credentials: {
accessKeyId: z.string().parse(process.env.S3_ACCESS_KEY_ID),
secretAccessKey: z.string().parse(process.env.S3_SECRET_ACCESS_KEY),
Expand All @@ -263,7 +274,7 @@ export function uploadTarballToS3(
return key;
})
.catch((err) => {
console.error("Failed to upload schema.json");
console.error("Failed to upload tarball");
console.error(err);
process.exit(1);
});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "index.js",
"scripts": {
"build": "turbo build",
"build-upload": "pnpm --filter ci build-upload",
"dev": "turbo dev",
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
Expand Down

0 comments on commit 63cb505

Please sign in to comment.