Skip to content

Commit 45c9c3d

Browse files
committed
ci: patch shared-features + enforce early bootstrap
- Add Jenkins bootstrap stage to run scripts/ci/bootstrap.sh before pipeline - Harden scripts/spm-shared-features-fixes.sh to patch Data.bytes across DerivedData - Add verification logs to confirm replacements applied Fixes CI archive failure: Data.bytes not found in WalletConnect/EthereumTransfer assemblies Signed-off-by: Fearless CI Agent <[email protected]> Signed-off-by: William Richter <[email protected]>
1 parent af1d1f4 commit 45c9c3d

File tree

2 files changed

+43
-27
lines changed

2 files changed

+43
-27
lines changed

Jenkinsfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,13 @@ def appPipeline = new org.ios.AppPipeline(
2323
uploadToNexusFor: ['master','develop','staging']
2424
)
2525

26-
appPipeline.runPipeline('fearless')
26+
// Ensure SPM and shared-features patches are applied before the main pipeline.
27+
// This resolves Web3 API drift (Data.bytes) and IrohaCrypto modulemap issues prior to archive.
28+
node('mac-fearless') {
29+
stage('Bootstrap CI deps') {
30+
checkout scm
31+
sh label: 'Bootstrap Pods/SPM/LFS + apply shared-features fixes', script: 'bash scripts/ci/bootstrap.sh'
32+
}
33+
}
2734

35+
appPipeline.runPipeline('fearless')

scripts/spm-shared-features-fixes.sh

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -107,37 +107,45 @@ echo "[spm-fixes] Completed shared-features-spm fixes"
107107

108108
# 2) Patch Web3 EthereumPrivateKey initializers to accept Data as [UInt8]
109109
patch_private_key_calls() {
110-
local base="$1/SourcePackages/checkouts/shared-features-spm"
111-
[[ -d "$base" ]] || return 0
112-
echo "[spm-fixes] Patching EthereumPrivateKey initializers under $base"
113-
# Known occurrences in sources
114-
local f1="$base/Sources/SSFTransferService/WalletConnectTransferServiceAssembly.swift"
115-
local f2="$base/Sources/SSFTransferService/InternalServices/Ethereum/EthereumTransferServiceAssembly.swift"
116-
if [[ -f "$f1" ]]; then
117-
# Strict replacement
118-
/usr/bin/sed -i '' -e 's/EthereumPrivateKey(privateKey: privateKey\.bytes)/EthereumPrivateKey(privateKey: Array(privateKey))/' "$f1" || true
119-
# Whitespace-tolerant replacement
120-
/usr/bin/sed -E -i '' -e 's/EthereumPrivateKey\(\s*privateKey:\s*privateKey\s*\.\s*bytes\s*\)/EthereumPrivateKey(privateKey: Array(privateKey))/' "$f1" || true
121-
# Fallback: replace property access broadly within this file only
122-
/usr/bin/sed -E -i '' -e 's/privateKey\s*\.\s*bytes/Array(privateKey)/g' "$f1" || true
123-
fi
124-
if [[ -f "$f2" ]]; then
125-
# Strict replacement
126-
/usr/bin/sed -i '' -e 's/EthereumPrivateKey(privateKey: secretKeyData\.bytes)/EthereumPrivateKey(privateKey: Array(secretKeyData))/' "$f2" || true
127-
# Whitespace-tolerant replacement
128-
/usr/bin/sed -E -i '' -e 's/EthereumPrivateKey\(\s*privateKey:\s*secretKeyData\s*\.\s*bytes\s*\)/EthereumPrivateKey(privateKey: Array(secretKeyData))/' "$f2" || true
129-
# Fallback: replace property access broadly within this file only
130-
/usr/bin/sed -E -i '' -e 's/secretKeyData\s*\.\s*bytes/Array(secretKeyData)/g' "$f2" || true
131-
fi
110+
local root="$1"
111+
local patched=0
112+
# Look for both known files under any shared-features-spm checkout below the root
113+
while IFS= read -r -d '' file; do
114+
echo "[spm-fixes] Patching Data.bytes -> Array(data) in: $file"
115+
# Apply several tolerant patterns
116+
/usr/bin/sed -E -i '' \
117+
-e 's/EthereumPrivateKey\(\s*privateKey:\s*privateKey\s*\.\s*bytes\s*\)/EthereumPrivateKey(privateKey: Array(privateKey))/' \
118+
-e 's/EthereumPrivateKey\(\s*privateKey:\s*secretKeyData\s*\.\s*bytes\s*\)/EthereumPrivateKey(privateKey: Array(secretKeyData))/' \
119+
-e 's/([[:<:]]privateKey[[:>:]]\s*)\.\s*bytes/Array(\1)/g' \
120+
-e 's/([[:<:]]secretKeyData[[:>:]]\s*)\.\s*bytes/Array(\1)/g' \
121+
"$file" || true
122+
123+
# Report remaining occurrences if any
124+
if /usr/bin/grep -n "\.bytes" "$file" >/dev/null 2>&1; then
125+
echo "[spm-fixes] After patch, '.bytes' still present in $file:" >&2
126+
/usr/bin/grep -n "\.bytes" "$file" | sed -n '1,4p' >&2 || true
127+
else
128+
patched=$((patched+1))
129+
fi
130+
done < <(/usr/bin/find "$root" -type f \( \
131+
-path "*/checkouts/shared-features-spm/Sources/SSFTransferService/WalletConnectTransferServiceAssembly.swift" -o \
132+
-path "*/checkouts/shared-features-spm/Sources/SSFTransferService/InternalServices/Ethereum/EthereumTransferServiceAssembly.swift" \
133+
\) -print0 2>/dev/null)
134+
135+
echo "[spm-fixes] Patched $patched file(s) under $root"
132136
}
133137

134-
# Apply in workspace and DerivedData
138+
# Apply in workspace and common DerivedData roots
135139
patch_private_key_calls "$BASE_DIR"
136-
for dd in "$HOME/Library/Developer/Xcode/DerivedData"/* "$BASE_DIR/DerivedData"/*; do
137-
patch_private_key_calls "$dd"
140+
for dd in "$HOME/Library/Developer/Xcode/DerivedData" "$BASE_DIR/DerivedData"; do
141+
[[ -d "$dd" ]] || continue
142+
for sub in "$dd"/*; do
143+
[[ -d "$sub" ]] || continue
144+
patch_private_key_calls "$sub"
145+
done
138146
done
139147

140-
echo "[spm-fixes] Completed EthereumPrivateKey call patches"
148+
echo "[spm-fixes] Completed EthereumPrivateKey call patches (with verification)"
141149

142150
# 3) Convert SSFCrypto AddressFactory from enum to struct (allow instantiation)
143151
patch_address_factory_struct() {

0 commit comments

Comments
 (0)