-
Notifications
You must be signed in to change notification settings - Fork 14
feat(build): implement additional internal KDF hosting #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
afbca02
18b9ced
2f887ba
e2a8df1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,60 +1,61 @@ | ||
| { | ||
| "api": { | ||
| "api_commit_hash": "a9fbf6096257b802e0aac4d936dcc5d2f0c28461", | ||
| "branch": "main", | ||
| "api_commit_hash": "4025b8c", | ||
| "branch": "master", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @smk762 KDF's default branch is Btw thanks for taking care of this :) |
||
| "fetch_at_build_enabled": true, | ||
| "concurrent_downloads_enabled": true, | ||
| "source_urls": [ | ||
| "https://api.github.com/repos/KomodoPlatform/komodo-defi-framework", | ||
| "https://sdk.devbuilds.komodo.earth/" | ||
| "https://sdk.devbuilds.komodo.earth/", | ||
| "https://nebula.decker.im/" | ||
| ], | ||
| "platforms": { | ||
| "web": { | ||
| "matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-wasm|mm2_[a-f0-9]{7,40}-wasm|mm2-[a-f0-9]{7,40}-wasm)\\.zip$", | ||
| "valid_zip_sha256_checksums": [ | ||
| "d4476637d566a87974ed54bd708e83f9d05a45a7dfae7ade57c0d00b0f0df631" | ||
| "d7cfd4dfa47f455ee283aa02c4dd11542b4bcf349928ec5b07a1f20b7141bd65" | ||
| ], | ||
| "path": "web/kdf/bin" | ||
| }, | ||
| "ios": { | ||
| "matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-ios-aarch64|mm2_[a-f0-9]{7,40}-ios-aarch64|mm2-[a-f0-9]{7,40}-ios-aarch64-CI)\\.zip$", | ||
| "valid_zip_sha256_checksums": [ | ||
| "efd8e8e738541a4838a2b044edc60030db9a4ba14392e30fb1a152472d4f4313" | ||
| "49c26280232fadbe456fbdd1dacc2cfd7697272202e59e41612691e50376a347" | ||
| ], | ||
| "path": "ios" | ||
| }, | ||
| "macos": { | ||
| "matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-mac-arm64|mm2-[a-f0-9]{7,40}-Darwin-Release)\\.zip$", | ||
| "matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-mac-arm64|kdf-macos-universal2-[a-f0-9]{7,40}|mm2-[a-f0-9]{7,40}-Darwin-Release)\\.zip$", | ||
| "valid_zip_sha256_checksums": [ | ||
| "bc411c8d95dbe565b0e56871babaea7412ccbd1ad7f525f3cf56a384a4a77ee7" | ||
| "30550ace9e66a1303ce3295ccd14f73759ff8fb56396419bd2d1d6e2da2cf54e" | ||
| ], | ||
| "path": "macos/bin" | ||
| }, | ||
| "windows": { | ||
| "matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-win-x86-64|mm2_[a-f0-9]{7,40}-win-x86-64|mm2-[a-f0-9]{7,40}-Win64)\\.zip$", | ||
| "valid_zip_sha256_checksums": [ | ||
| "d9849d01962b4e05899cde7ec17f6b9e8ba9411f484369724c7a73a4b6a3fb80" | ||
| "db77335c8637d03e467c2cbb275ea4e57962ca22ed29542941f7105e5ba69e9a" | ||
| ], | ||
| "path": "windows/bin" | ||
| }, | ||
| "android-armv7": { | ||
| "matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-android-armv7|mm2_[a-f0-9]{7,40}-android-armv7|mm2-[a-f0-9]{7,40}-android-armv7-CI)\\.zip$", | ||
| "valid_zip_sha256_checksums": [ | ||
| "10ae609f3c7e4ed47e5a1134dd74da84375f9a1c6538c985afb1c148d58f8756" | ||
| "129f6f2467f14c9b7d9f7629d33d70197cb94b2237cbdb01a58e567a1b3260ee" | ||
| ], | ||
| "path": "android/app/src/main/cpp/libs/armeabi-v7a" | ||
| }, | ||
| "android-aarch64": { | ||
| "matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-android-aarch64|mm2_[a-f0-9]{7,40}-android-aarch64|mm2-[a-f0-9]{7,40}-android-aarch64-CI)\\.zip$", | ||
| "valid_zip_sha256_checksums": [ | ||
| "ab4b5311e0d1b6b2f57ed1783d5b7a51c4b7558cbf0bad593d9235f6a32db906" | ||
| "00ea932edb7750c60c5d91705907b52ab018a7230f270a0f4286e41ee42cdf74" | ||
| ], | ||
| "path": "android/app/src/main/cpp/libs/arm64-v8a" | ||
| }, | ||
| "linux": { | ||
| "matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-linux-x86-64|mm2_[a-f0-9]{7,40}-linux-x86-64|mm2-[a-f0-9]{7,40}-Linux-Release)\\.zip$", | ||
| "valid_zip_sha256_checksums": [ | ||
| "913a165e434ed9696c0e8c9a1875bfd6448e291f85d2e7e8dae78618ef3534e3" | ||
| "e25067ddb7b51455a109874722a595d7bc2ee4243ebd3af3e98426874d42f23d" | ||
| ], | ||
| "path": "linux/bin" | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,42 +30,64 @@ class DevBuildsArtefactDownloader implements ArtefactDownloader { | |||||
| ApiFileMatchingConfig matchingConfig, | ||||||
| String platform, | ||||||
| ) async { | ||||||
| final url = '$sourceUrl/$apiBranch/'; | ||||||
| final response = await http.get(Uri.parse(url)); | ||||||
| response.throwIfNotSuccessResponse(); | ||||||
| // Try both branch-scoped and base-scoped listings to support different mirrors (devbuilds, Nebula, etc.) | ||||||
| final candidateListingUrls = <String>{ | ||||||
| // Typical devbuilds layout: <mirror>/<branch>/ | ||||||
| if (apiBranch.isNotEmpty) '$sourceUrl/$apiBranch/', | ||||||
| // Nebula may host a flat listing without branch segment | ||||||
| '$sourceUrl/', | ||||||
| }; | ||||||
|
|
||||||
| final document = parser.parse(response.body); | ||||||
| final extensions = ['.zip']; | ||||||
|
|
||||||
| // Support both full and short hash variants | ||||||
| final fullHash = apiCommitHash; | ||||||
| final shortHash = apiCommitHash.substring(0, 7); | ||||||
| _log.info('Looking for files with hash $fullHash or $shortHash'); | ||||||
|
|
||||||
| // Look for files with either hash length | ||||||
| final attemptedFiles = <String>[]; | ||||||
| for (final element in document.querySelectorAll('a')) { | ||||||
| final href = element.attributes['href']; | ||||||
| if (href != null) attemptedFiles.add(href); | ||||||
| if (href != null && | ||||||
| matchingConfig.matches(href) && | ||||||
| extensions.any(href.endsWith)) { | ||||||
| if (href.contains(fullHash) || href.contains(shortHash)) { | ||||||
| _log.info('Found matching file: $href'); | ||||||
| return '$sourceUrl/$apiBranch/$href'; | ||||||
| for (final listingUrl in candidateListingUrls) { | ||||||
| try { | ||||||
| final response = await http.get(Uri.parse(listingUrl)); | ||||||
| response.throwIfNotSuccessResponse(); | ||||||
| final document = parser.parse(response.body); | ||||||
|
|
||||||
| final attemptedFiles = <String>[]; | ||||||
| for (final element in document.querySelectorAll('a')) { | ||||||
| final href = element.attributes['href']; | ||||||
| if (href == null) continue; | ||||||
| attemptedFiles.add(href); | ||||||
|
|
||||||
| // Normalize href for directory indexes that include absolute paths | ||||||
| final fileName = path.basename(href); | ||||||
|
|
||||||
| // Ignore wallet archives on Nebula index | ||||||
| if (fileName.contains('wallet')) { | ||||||
| continue; | ||||||
| } | ||||||
|
|
||||||
| if (matchingConfig.matches(fileName) && | ||||||
| extensions.any(fileName.endsWith)) { | ||||||
| if (fileName.contains(fullHash) || fileName.contains(shortHash)) { | ||||||
| _log.info('Found matching file: $fileName at $listingUrl'); | ||||||
| // Build absolute URL respecting whether href is absolute or relative | ||||||
| final resolvedUrl = href.startsWith('http') | ||||||
| ? href | ||||||
| : path.join(listingUrl, fileName).replaceAll('\\', '/'); | ||||||
|
||||||
| : path.join(listingUrl, fileName).replaceAll('\\', '/'); | |
| : Uri.parse(listingUrl).resolve(fileName).toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit hash appears to be shortened to 7 characters while the branch changed from 'main' to 'master'. Ensure this commit actually exists on the master branch to avoid build failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smk762, this is a helpful idea to allow short commit hashes for the config updater script, but we can/should still require full commit hashes in the build config. Note that the build config updater script (ran in dev environment) is independent of the build step for fetching and downloading the KDF binaries.