Skip to content

Commit c784a41

Browse files
committed
🌱 build workflow fixes
Signed-off-by: David Zager <david.j.zager@gmail.com>
1 parent b6e0b33 commit c784a41

File tree

5 files changed

+143
-29
lines changed

5 files changed

+143
-29
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,52 @@ jobs:
222222
run: |
223223
npm run collect-assets -- --use-release
224224
225+
- name: Verify runtime assets downloaded
226+
working-directory: ./.upstream-workspace
227+
run: |
228+
echo "🔍 Verifying required runtime assets..."
229+
MISSING=0
230+
231+
# Language extension provider binaries (must be bundled — no runtime fallback)
232+
for provider in java-external-provider generic-external-provider golang-dependency-provider c-sharp-analyzer-provider; do
233+
DIR="downloaded_assets/${provider}"
234+
if [[ ! -d "$DIR" ]] || [[ -z "$(ls -A "$DIR" 2>/dev/null)" ]]; then
235+
echo "❌ Missing required provider binary: ${provider}"
236+
MISSING=$((MISSING + 1))
237+
else
238+
COUNT=$(find "$DIR" -type f | wc -l)
239+
echo "✅ ${provider}: ${COUNT} files"
240+
fi
241+
done
242+
243+
# Seed assets
244+
for asset in rulesets jdtls-bundles opensource-labels-file; do
245+
DIR="downloaded_assets/${asset}"
246+
if [[ ! -d "$DIR" ]] || [[ -z "$(ls -A "$DIR" 2>/dev/null)" ]]; then
247+
echo "⚠️ Missing seed asset: ${asset}"
248+
else
249+
echo "✅ ${asset}: present"
250+
fi
251+
done
252+
253+
# kai binary is optional (core uses fallbackAssets for runtime download)
254+
KAI_DIR="downloaded_assets/kai"
255+
if [[ -d "$KAI_DIR" ]] && [[ -n "$(ls -A "$KAI_DIR" 2>/dev/null)" ]]; then
256+
echo "✅ kai: present (will be bundled)"
257+
else
258+
echo "ℹ️ kai: not bundled (core extension uses fallbackAssets for runtime download)"
259+
fi
260+
261+
if [[ $MISSING -gt 0 ]]; then
262+
echo ""
263+
echo "❌ ${MISSING} required provider binaries are missing."
264+
echo "❌ Language extensions will not function without these binaries."
265+
exit 1
266+
fi
267+
268+
echo ""
269+
echo "✅ All required runtime assets verified"
270+
225271
- name: Set version for build
226272
working-directory: ./.upstream-workspace
227273
run: |

mta-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
upstream:
22
repository: konveyor/editor-extensions
3-
ref: 504c825dd15f415ae0282fec44274b8bcbb577ea
3+
ref: a87decba30735b514cdaca456760460511d10b9c
44
semanticRef: release-0.4

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mta-vscode-extension-builder",
3-
"version": "8.0.0",
3+
"version": "8.1.0",
44
"private": true,
55
"description": "Build orchestrator for MTA VSCode extension based on release-0.2",
66
"scripts": {

scripts/postbuild.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,13 @@ function check(condition, errorMsg) {
4545
return true;
4646
}
4747

48-
// ─── Version Updates ────────────────────────────────────────────────────────
48+
// ─── Version Verification ────────────────────────────────────────────────────
49+
// Version is set by prebuild.js (before webpack) so EXTENSION_VERSION constants
50+
// are baked correctly at compile time. Here we just verify it stuck.
4951

50-
console.log(`📝 Updating all package.json versions to ${extensionVersion}...`);
52+
console.log(`📝 Verifying version ${extensionVersion} across workspaces...`);
5153

5254
const workspaces = [
53-
"package.json",
54-
"extra-types/package.json",
55-
"shared/package.json",
56-
"webview-ui/package.json",
57-
"agentic/package.json",
5855
"vscode/core/package.json",
5956
"vscode/java/package.json",
6057
"vscode/javascript/package.json",
@@ -67,13 +64,14 @@ for (const ws of workspaces) {
6764
const fullPath = path.join(__dirname, "..", ws);
6865
if (fs.existsSync(fullPath)) {
6966
const pkg = JSON.parse(fs.readFileSync(fullPath, "utf8"));
70-
pkg.version = extensionVersion;
71-
fs.writeFileSync(fullPath, JSON.stringify(pkg, null, 2));
72-
console.log(` ✅ Updated ${ws}`);
67+
check(
68+
pkg.version === extensionVersion,
69+
`${ws} version: expected "${extensionVersion}", got "${pkg.version}"`,
70+
);
7371
}
7472
}
7573

76-
console.log("📝 Version updates complete!\n");
74+
console.log("📝 Version verification complete!\n");
7775

7876
// ─── Core Extension Verification ────────────────────────────────────────────
7977

@@ -177,8 +175,8 @@ if (corePkg.fallbackAssets) {
177175
warnings.push(`Only ${assetCount} platforms in fallback assets (expected 6)`);
178176
}
179177
check(
180-
corePkg.fallbackAssets.sha256sumFile === "sha256sum.txt",
181-
`sha256sumFile: expected "sha256sum.txt", got "${corePkg.fallbackAssets.sha256sumFile}"`,
178+
corePkg.fallbackAssets.sha256sumFile === "SHA256SUM",
179+
`sha256sumFile: expected "SHA256SUM", got "${corePkg.fallbackAssets.sha256sumFile}"`,
182180
);
183181
} else {
184182
warnings.push("No fallback assets configuration found on core extension");

scripts/prebuild.js

Lines changed: 84 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ export const shortName = "MTA";
1717
export const repositoryUrl = "https://github.com/migtools/editor-extensions";
1818
export const bugsUrl = "https://github.com/migtools/editor-extensions/issues";
1919
export const homepageUrl = "https://developers.redhat.com/products/mta/overview";
20+
// export const fallbackAssetsUrl = "https://developers.redhat.com/content-gateway/rest/browse/pub/mta/8.0.1/"
21+
export const fallbackAssetsUrl = "https://download.devel.redhat.com/devel/candidates/middleware/migrationtoolkit/MTA-8.1.0.CR2/"
22+
23+
// ─── TEMPORARY PRE-RELEASE ASSET HANDLING ───────────────────────────────────
24+
// TODO: REMOVE THIS SECTION WHEN MTA 8.1.0 GOES GA AND ASSETS ARE PUBLIC
25+
// Currently using CR2 (candidate release) which requires VPN access
26+
const isPreRelease = fallbackAssetsUrl.includes('candidates') || fallbackAssetsUrl.includes('CR');
27+
// ─────────────────────────────────────────────────────────────────────────────
2028

2129
// Extension name mapping: upstream → downstream
2230
const NAME_MAP = {
@@ -207,10 +215,26 @@ function brandCoreExtension(pkg) {
207215
}));
208216
}
209217

210-
// Remove kai from includedAssetPaths (runtime download via fallback)
211-
if (pkg.includedAssetPaths?.kai !== undefined) {
212-
delete pkg.includedAssetPaths.kai;
213-
console.log(" ✅ Removed kai binary assets from package (runtime download enabled)");
218+
// Asset management strategy for production vs pre-release builds
219+
if (isPreRelease && pkg.includedAssetPaths?.kai !== undefined) {
220+
// Pre-release builds: Keep assets bundled to avoid VPN requirements
221+
console.log(" 📦 Keeping kai binary assets bundled (pre-release build)");
222+
console.log(" 🚨 Pre-release mode: Assets bundled to avoid VPN requirement at runtime");
223+
} else if (!isPreRelease && pkg.includedAssetPaths?.kai !== undefined) {
224+
// Production builds: Fail hard if dev assets are still bundled
225+
console.error(" ❌ PRODUCTION BUILD ERROR: Dev assets still bundled!");
226+
console.error(" ❌ Found bundled kai assets in production build");
227+
console.error(" ❌ This would ship dev/internal assets to end users");
228+
console.error(" 💡 Solution: Remove kai assets from upstream package.json");
229+
console.error(" or verify fallbackAssetsUrl points to public release");
230+
process.exit(1);
231+
} else if (!isPreRelease) {
232+
// Production builds: Assets removed, runtime download enabled
233+
console.log(" ✅ No bundled assets (runtime download from public servers)");
234+
} else {
235+
// Pre-release but no assets found
236+
console.log(" ⚠️ Pre-release mode but no kai assets found");
237+
console.log(" ⚠️ Extension may fail at runtime without bundled or downloadable assets");
214238
}
215239

216240
return pkg;
@@ -333,8 +357,7 @@ function transformSourceCode() {
333357
async function generateFallbackAssets(pkg) {
334358
console.log(" 🔧 Generating fallback assets configuration...");
335359

336-
const FALLBACK_ASSETS_URL =
337-
"https://developers.redhat.com/content-gateway/rest/browse/pub/mta/8.0.0/";
360+
const FALLBACK_ASSETS_URL = fallbackAssetsUrl;
338361

339362
const PLATFORM_MAPPING = {
340363
"linux-x64": "linux-amd64",
@@ -357,18 +380,18 @@ async function generateFallbackAssets(pkg) {
357380
try {
358381
console.log(` Fetching from: ${FALLBACK_ASSETS_URL}`);
359382

360-
// Verify sha256sum.txt exists
361-
console.log(" 🔍 Verifying sha256sum.txt exists...");
383+
// Verify SHA256SUM exists
384+
console.log(" 🔍 Verifying SHA256SUM exists...");
362385
try {
363-
const sha256Response = await fetchText(`${FALLBACK_ASSETS_URL}sha256sum.txt`);
386+
const sha256Response = await fetchText(`${FALLBACK_ASSETS_URL}SHA256SUM`);
364387
if (!sha256Response || sha256Response.trim().length === 0) {
365-
throw new Error("sha256sum.txt is empty");
388+
throw new Error("SHA256SUM is empty");
366389
}
367-
console.log(" ✅ sha256sum.txt found and not empty");
390+
console.log(" ✅ SHA256SUM found and not empty");
368391
} catch (sha256Error) {
369-
console.error(` ❌ Failed to fetch sha256sum.txt: ${sha256Error.message}`);
392+
console.error(` ❌ Failed to fetch SHA256SUM: ${sha256Error.message}`);
370393
console.error(
371-
" ❌ Build failed: sha256sum.txt is required for secure asset downloads",
394+
" ❌ Build failed: SHA256SUM is required for secure asset downloads",
372395
);
373396
process.exit(1);
374397
}
@@ -430,13 +453,20 @@ async function generateFallbackAssets(pkg) {
430453

431454
pkg.fallbackAssets = {
432455
baseUrl: FALLBACK_ASSETS_URL,
433-
sha256sumFile: "sha256sum.txt",
456+
sha256sumFile: "SHA256SUM",
434457
assets,
435458
};
436459

437460
console.log(
438461
` ✅ Generated fallback assets for ${Object.keys(assets).length} platforms`,
439462
);
463+
464+
// Reminder about GA transition
465+
if (isPreRelease) {
466+
console.log(" 🚨 When MTA 8.1.0 goes GA, update fallbackAssetsUrl to:");
467+
console.log(" https://developers.redhat.com/content-gateway/rest/browse/pub/mta/8.1.0/");
468+
console.log(" This will auto-disable bundled assets and enable runtime downloads");
469+
}
440470
} catch (error) {
441471
console.error(` ❌ Failed to generate fallback assets: ${error.message}`);
442472
console.error(
@@ -498,6 +528,46 @@ const isDirectExecution =
498528
if (isDirectExecution) {
499529
console.log("🔄 Running MTA prebuild for multi-extension architecture...\n");
500530

531+
// Show loud warning for pre-release builds
532+
if (isPreRelease) {
533+
console.log("🚨🚨🚨 PRE-RELEASE BUILD DETECTED 🚨🚨🚨");
534+
console.log(" Using candidate release assets that require VPN access:");
535+
console.log(` ${fallbackAssetsUrl}`);
536+
console.log(" Assets will be BUNDLED to avoid runtime download failures");
537+
console.log(" 📝 TODO: Update to GA URL when MTA 8.1.0 is officially released:");
538+
console.log(" https://developers.redhat.com/content-gateway/rest/browse/pub/mta/8.1.0/");
539+
console.log("🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨\n");
540+
}
541+
542+
// 0. Set version across all workspaces BEFORE webpack runs
543+
// This ensures webpack's DefinePlugin bakes the correct MTA version
544+
// into EXTENSION_VERSION constants at compile time.
545+
console.log(`📝 Setting version ${extensionVersion} across all workspaces...`);
546+
const workspacePaths = [
547+
"package.json",
548+
"extra-types/package.json",
549+
"shared/package.json",
550+
"webview-ui/package.json",
551+
"agentic/package.json",
552+
"vscode/core/package.json",
553+
"vscode/java/package.json",
554+
"vscode/javascript/package.json",
555+
"vscode/go/package.json",
556+
"vscode/csharp/package.json",
557+
"vscode/konveyor/package.json",
558+
];
559+
560+
for (const ws of workspacePaths) {
561+
const fullPath = path.join(__dirname, "..", ws);
562+
if (fs.existsSync(fullPath)) {
563+
const pkg = JSON.parse(fs.readFileSync(fullPath, "utf8"));
564+
pkg.version = extensionVersion;
565+
fs.writeFileSync(fullPath, JSON.stringify(pkg, null, 2));
566+
console.log(` ✅ ${ws}`);
567+
}
568+
}
569+
console.log("");
570+
501571
// 1. Transform core extension
502572
console.log("📦 Branding core extension (vscode/core)...");
503573
let corePkg = readPackageJson("vscode/core/package.json");

0 commit comments

Comments
 (0)