Skip to content

Commit cc9ee98

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

File tree

5 files changed

+99
-25
lines changed

5 files changed

+99
-25
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: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ 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/"
2022

2123
// Extension name mapping: upstream → downstream
2224
const NAME_MAP = {
@@ -333,8 +335,7 @@ function transformSourceCode() {
333335
async function generateFallbackAssets(pkg) {
334336
console.log(" 🔧 Generating fallback assets configuration...");
335337

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

339340
const PLATFORM_MAPPING = {
340341
"linux-x64": "linux-amd64",
@@ -357,18 +358,18 @@ async function generateFallbackAssets(pkg) {
357358
try {
358359
console.log(` Fetching from: ${FALLBACK_ASSETS_URL}`);
359360

360-
// Verify sha256sum.txt exists
361-
console.log(" 🔍 Verifying sha256sum.txt exists...");
361+
// Verify SHA256SUM exists
362+
console.log(" 🔍 Verifying SHA256SUM exists...");
362363
try {
363-
const sha256Response = await fetchText(`${FALLBACK_ASSETS_URL}sha256sum.txt`);
364+
const sha256Response = await fetchText(`${FALLBACK_ASSETS_URL}SHA256SUM`);
364365
if (!sha256Response || sha256Response.trim().length === 0) {
365-
throw new Error("sha256sum.txt is empty");
366+
throw new Error("SHA256SUM is empty");
366367
}
367-
console.log(" ✅ sha256sum.txt found and not empty");
368+
console.log(" ✅ SHA256SUM found and not empty");
368369
} catch (sha256Error) {
369-
console.error(` ❌ Failed to fetch sha256sum.txt: ${sha256Error.message}`);
370+
console.error(` ❌ Failed to fetch SHA256SUM: ${sha256Error.message}`);
370371
console.error(
371-
" ❌ Build failed: sha256sum.txt is required for secure asset downloads",
372+
" ❌ Build failed: SHA256SUM is required for secure asset downloads",
372373
);
373374
process.exit(1);
374375
}
@@ -430,7 +431,7 @@ async function generateFallbackAssets(pkg) {
430431

431432
pkg.fallbackAssets = {
432433
baseUrl: FALLBACK_ASSETS_URL,
433-
sha256sumFile: "sha256sum.txt",
434+
sha256sumFile: "SHA256SUM",
434435
assets,
435436
};
436437

@@ -498,6 +499,35 @@ const isDirectExecution =
498499
if (isDirectExecution) {
499500
console.log("🔄 Running MTA prebuild for multi-extension architecture...\n");
500501

502+
// 0. Set version across all workspaces BEFORE webpack runs
503+
// This ensures webpack's DefinePlugin bakes the correct MTA version
504+
// into EXTENSION_VERSION constants at compile time.
505+
console.log(`📝 Setting version ${extensionVersion} across all workspaces...`);
506+
const workspacePaths = [
507+
"package.json",
508+
"extra-types/package.json",
509+
"shared/package.json",
510+
"webview-ui/package.json",
511+
"agentic/package.json",
512+
"vscode/core/package.json",
513+
"vscode/java/package.json",
514+
"vscode/javascript/package.json",
515+
"vscode/go/package.json",
516+
"vscode/csharp/package.json",
517+
"vscode/konveyor/package.json",
518+
];
519+
520+
for (const ws of workspacePaths) {
521+
const fullPath = path.join(__dirname, "..", ws);
522+
if (fs.existsSync(fullPath)) {
523+
const pkg = JSON.parse(fs.readFileSync(fullPath, "utf8"));
524+
pkg.version = extensionVersion;
525+
fs.writeFileSync(fullPath, JSON.stringify(pkg, null, 2));
526+
console.log(` ✅ ${ws}`);
527+
}
528+
}
529+
console.log("");
530+
501531
// 1. Transform core extension
502532
console.log("📦 Branding core extension (vscode/core)...");
503533
let corePkg = readPackageJson("vscode/core/package.json");

0 commit comments

Comments
 (0)