Skip to content
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

In consumer mode, pod install fails unexpendently #232

Open
anuragstar opened this issue Dec 14, 2023 · 28 comments
Open

In consumer mode, pod install fails unexpendently #232

anuragstar opened this issue Dec 14, 2023 · 28 comments

Comments

@anuragstar
Copy link

anuragstar commented Dec 14, 2023

@polac24 We are using cocapods integration for XCRemote cache integration, in producer mode it works fine, but in consumer mode it is failing, can you please help us to resolve this issue.

bundle exec pod install is failing with below error
error: Prepare failed with error: Finding a common commit failed. Please try to call git fetch origin. [Error: statusError("status 1: ", 1)]

[- ] CocoaPods cocoapods-xcremotecache plugin
[ ] Automatic integration using xcprepare integrate ...
[ ] Manual integration
[ ] Carthage

Expected/desired behavior

Minimal reproduction of the problem with instructions

Producer Logs

 [REPLACE THIS WITH YOUR INFORMATION] 

Consumer Logs

 [REPLACE THIS WITH YOUR INFORMATION] 

Pods/Carthage file

 [REPLACE THIS WITH YOUR INFORMATION] 

Environment

  • XCRemoteCache: X.Y.Z
  • cocoapods-xcremotecache: X.Y.Z <!-- check with gem list cocoapods-xcremotecache >
  • HTTP cache server: ... <!-- e.g. demo docker, nginx, AWS etc. >
  • Xcode: X.Y.Z

Post build stats

 [REPLACE THIS WITH YOUR INFORMATION] 

Others

@anuragstar
Copy link
Author

anuragstar commented Dec 14, 2023

@polac24 In logs when I am running in consumer mode, it's returning 404 whenever I do pod install-
2023-12-14 15:39:30.712 I xcprepare[53004:2d1d3c2] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-14 15:39:30.712 I xcprepare[53004:2d1d3c2] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-14 15:39:31.295 I xcprepare[53004:2d1d3d6] Network request failed with unsuccessful code 404
2023-12-14 15:39:31.295 I xcprepare[53004:2d1d3c2] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-14 15:39:31.295 I xcprepare[53004:2d1d3c2] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-14 15:39:31.343 I xcprepare[53004:2d1d3d6] Network request failed with unsuccessful code 404
2023-12-14 15:39:31.344 I xcprepare[53004:2d1d3c2] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-14 15:39:31.344 I xcprepare[53004:2d1d3c2] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-14 15:39:31.374 I xcprepare[53004:2d1d3d6] Network request failed with unsuccessful code 404
2023-12-14 15:39:31.639 E xcprepare[53004:2d1d3c2] Prepare failed with error: Finding a common commit failed. Please try to call git fetch origin. [Error: statusError("status 1: ", 1)]

@polac24
Copy link
Collaborator

polac24 commented Dec 15, 2023

that logs suggests that a git command git merge-base origin/primary_branch HEAD failed (the origin/primary_branch) is taken fro your config.

  • origin -> is taken dynamically resolved on your CI machine by calling git remote -v and finding remote's name which matches the primary_repo in your .rcinfo
  • primary_branch is taken from primary_branch in .rcinfo (often master or main).

Thus I would verify your git on CI:

  • has correctly set remote pointing to the git address (validate that with git remote -v)
  • the primary branch is available on your CI (validate with git show {primary_branch}
  • The git repo is not shallow (validate with git log -n 100 {origin/primary_branch}, like git log -n 100 origin/main)
  • finally, make sure there is common commit between the current commit and the remote one: git merge-base {origin/primary_branch} HEAD, like git merge-base origin/main HEAD)

@anuragstar
Copy link
Author

anuragstar commented Dec 15, 2023

hey @polac24 after git fetch origin again it passed the pod installation step, from the same primary branch, I see consumer mode is failing, can you please help us why it is happening.
It is failing with no artifact available but our producer pipeline is successful, where we pushed the artifact - [XCRC] XCRemoteCache disabled - no artifacts available

[!] <PBXSourcesBuildPhase UUID=43353290265E67CA00EC4CB5>attempted to initialize an object with an unknown UUID.B125BCAC270B5CEF00AF6D57for attribute:files`. This can be the result of a merge and the unknown UUID is being discarded.
[XCRC] XCRemoteCache disabled - no artifacts available
Pod installation complete! There are 97 dependencies from the Podfile and 102 total pods installed.

[!] Charts has been deprecated in favor of DGCharts
Timestamp Ty Process[PID:TID]
2023-12-15 08:26:44.248 I xcprepare[94739:1768124] Extra config override failed with missingConfigurationFile(user.rcinfo -- file:///Users/***2/Documents/action-runner-xcode15-runner3/actions-runner/_work/mono-ios/mono-ios/***x-tvos/). Skipping extra configuration
2023-12-15 08:26:44.574 I xcprepare[94739:1768124] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:44.574 I xcprepare[94739:1768124] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:44.825 I xcprepare[94739:1768141] Network request failed with unsuccessful code 404
2023-12-15 08:26:44.825 I xcprepare[94739:1768124] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:44.825 I xcprepare[94739:1768124] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:44.863 I xcprepare[94739:176813a] Network request failed with unsuccessful code 404
2023-12-15 08:26:44.863 I xcprepare[94739:1768124] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:44.863 I xcprepare[94739:1768124] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:44.901 I xcprepare[94739:176813c] Network request failed with unsuccessful code 404
2023-12-15 08:26:45.155 I xcprepare[94739:1768124] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/marker/808322822b6611900f28674056363b5b37b1d491-Debug-iphonesimulator-14B47b-5
2023-12-15 08:26:45.155 I xcprepare[94739:1768124] Making request https://cache-address-s3-bucket/cache/marker/808322822b6611900f28674056363b5b37b1d491-Debug-iphonesimulator-14B47b-5
2023-12-15 08:26:45.199 I xcprepare[94739:176813c] Network request failed with unsuccessful code 404
2023-12-15 08:26:45.326 I xcprepare[94739:1768124] No artifacts available
2023-12-15 08:26:47.575 I xcprepare[94750:1768170] Extra config override failed with missingConfigurationFile(user.rcinfo -- file:///Users/***2/Documents/action-runner-xcode15/actions-runner/_work/mono-ios/mono-ios/***x-ios-mobile/). Skipping extra configuration
2023-12-15 08:26:47.856 I xcprepare[94750:1768170] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:47.856 I xcprepare[94750:1768170] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:48.035 I xcprepare[94750:1768171] Network request failed with unsuccessful code 404
2023-12-15 08:26:48.036 I xcprepare[94750:1768170] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:48.036 I xcprepare[94750:1768170] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:48.068 I xcprepare[94750:1768171] Network request failed with unsuccessful code 404
2023-12-15 08:26:48.068 I xcprepare[94750:1768170] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:48.068 I xcprepare[94750:1768170] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:26:48.099 I xcprepare[94750:1768178] Network request failed with unsuccessful code 404
2023-12-15 08:26:48.390 I xcprepare[94750:1768170] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/marker/808322822b6611900f28674056363b5b37b1d491-Debug-iphonesimulator-14B47b-5
2023-12-15 08:26:48.390 I xcprepare[94750:1768170] Making request https://cache-address-s3-bucket/cache/marker/808322822b6611900f28674056363b5b37b1d491-Debug-iphonesimulator-14B47b-5
2023-12-15 08:26:48.423 I xcprepare[94750:1768178] Network request failed with unsuccessful code 404
2023-12-15 08:26:48.561 I xcprepare[94750:1768170] No artifacts available
2023-12-15 08:27:19.892 I xcprepare[95150:1768735] Extra config override failed with missingConfigurationFile(user.rcinfo -- file:///Users/***2/Documents/action-runner-xcode15-runner3/actions-runner/_work/mono-ios/mono-ios/***x-tvos/). Skipping extra configuration
2023-12-15 08:27:20.165 I xcprepare[95150:1768735] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:20.165 I xcprepare[95150:1768735] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:20.541 I xcprepare[95150:1768736] Network request failed with unsuccessful code 404
2023-12-15 08:27:20.541 I xcprepare[95150:1768735] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:20.541 I xcprepare[95150:1768735] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:20.572 I xcprepare[95150:1768738] Network request failed with unsuccessful code 404
2023-12-15 08:27:20.572 I xcprepare[95150:1768735] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:20.572 I xcprepare[95150:1768735] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:20.603 I xcprepare[95150:1768736] Network request failed with unsuccessful code 404
2023-12-15 08:27:20.879 I xcprepare[95150:1768735] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/marker/808322822b6611900f28674056363b5b37b1d491-Debug-iphonesimulator-14B47b-5
2023-12-15 08:27:20.879 I xcprepare[95150:1768735] Making request https://cache-address-s3-bucket/cache/marker/808322822b6611900f28674056363b5b37b1d491-Debug-iphonesimulator-14B47b-5
2023-12-15 08:27:20.908 I xcprepare[95150:1768736] Network request failed with unsuccessful code 404
2023-12-15 08:27:21.051 I xcprepare[95150:1768735] No artifacts available
2023-12-15 08:27:35.372 I xcprepare[95187:17688ab] Extra config override failed with missingConfigurationFile(user.rcinfo -- file:///Users/***2/Documents/action-runner-xcode15/actions-runner/_work/mono-ios/mono-ios/***x-ios-mobile/). Skipping extra configuration
2023-12-15 08:27:35.652 I xcprepare[95187:17688ab] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:35.652 I xcprepare[95187:17688ab] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:35.962 I xcprepare[95187:17688b4] Network request failed with unsuccessful code 404
2023-12-15 08:27:35.962 I xcprepare[95187:17688ab] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:35.962 I xcprepare[95187:17688ab] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:35.992 I xcprepare[95187:17688af] Network request failed with unsuccessful code 404
2023-12-15 08:27:35.992 I xcprepare[95187:17688ab] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:35.992 I xcprepare[95187:17688ab] Making request https://cache-address-s3-bucket/cache/nginx-health
2023-12-15 08:27:36.021 I xcprepare[95187:17688ac] Network request failed with unsuccessful code 404
2023-12-15 08:27:36.305 I xcprepare[95187:17688ab] Checking HTTP file HEAD for https://cache-address-s3-bucket/cache/marker/808322822b6611900f28674056363b5b37b1d491-Debug-iphonesimulator-14B47b-5
2023-12-15 08:27:36.305 I xcprepare[95187:17688ab] Making request https://cache-address-s3-bucket/cache/marker/808322822b6611900f28674056363b5b37b1d491-Debug-iphonesimulator-14B47b-5
2023-12-15 08:27:36.335 I xcprepare[95187:17688ac] Network request failed with unsuccessful code 404
2023-12-15 08:27:36.479 I xcprepare[95187:17688ab] No artifacts available
`

@polac24
Copy link
Collaborator

polac24 commented Dec 15, 2023

2023-12-15 08:26:45.155 I xcprepare[94739:1768124] Making request https://cache-address-s3-bucket/cache/marker/808322822b6611900f28674056363b5b37b1d491-Debug-iphonesimulator-14B47b-5
2023-12-15 08:26:45.199 I xcprepare[94739:176813c] Network request failed with unsuccessful code 404

That line says that there are not artifacts generated in the cache for:

  • commit 808322822b6611900f28674056363b5b37b1d491
  • configuration: Debug
  • platform: iphonesimulator
  • Xcode: 14B47b, (Xcode 14.1)

Please make sure a producer correctly builds it and marks it as "cacheable" (ensure the final_target is correctly set)

xcremotecache({
    'cache_addresses' => ['http://localhost:8080/cache/pods'],
    'primary_repo' => 'https://your.primary.repo.git',
    'mode' => 'producer',
    'final_target' => 'NameOfYourUltimateTarget' # the very last target that is built in the flow (often the `MyApplicationApp`)
})

If correctly setup, in your bucket, there should be an empty file: https://cache-address-s3-bucket/cache/marker/808322822b6611900f28674056363b5b37b1d491-Debug-iphonesimulator-14B47b-5

@anuragstar
Copy link
Author

@polac24 the final target is correct, the only thing I can see is I am using - producer-fast mode will producer-fast mode is working as expected on CI, when I tried on my local - producer-fast mode was running quick able to push the artifacts, in consumer mode able to fetch the artifacts.

@polac24
Copy link
Collaborator

polac24 commented Dec 15, 2023

producer-fast is very experimental and I don't recommend using it initially. Try with producer to eliminate potential bugs.

@anuragstar
Copy link
Author

@polac24 In consumer mode when we are running on another machine it is not able to find artifacts, both producer and consumer machines are of similar configuration

2023-12-19 08:17:58.055 I xcprepare[58408:c98df5] Extra config override failed with missingConfigurationFile(user.rcinfo -- file:///Users/abc/Documents/action-runner-intel-snapshot/actions-runner/_work/mono-ios/mono-ios/abc-ios-mobile/). Skipping extra configuration
INFO 2023-12-19 08:24:21 2023-12-19 08:17:58.539 I xcprepare[58408:c98df5] Checking HTTP file HEAD for https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:17:58.539 I xcprepare[58408:c98df5] Making request https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:17:58.758 I xcprepare[58408:c98dfc] Network request failed with unsuccessful code 404
INFO 2023-12-19 08:24:21 2023-12-19 08:17:58.758 I xcprepare[58408:c98df5] Checking HTTP file HEAD for https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:17:58.758 I xcprepare[58408:c98df5] Making request https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:17:58.789 I xcprepare[58408:c98dfc] Network request failed with unsuccessful code 404
INFO 2023-12-19 08:24:21 2023-12-19 08:17:58.789 I xcprepare[58408:c98df5] Checking HTTP file HEAD for https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:17:58.789 I xcprepare[58408:c98df5] Making request https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:17:58.818 I xcprepare[58408:c98dfc] Network request failed with unsuccessful code 404
INFO 2023-12-19 08:24:21 2023-12-19 08:17:58.957 E xcprepare[58408:c98df5] XCRemoteCache's xcprepare failed to find git remote with [email protected]:hotstar/mono-ios.git address.Check that your git configuration (git remote -v) specifies it.
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.151 I xcprepare[60445:c9ae4d] Extra config override failed with missingConfigurationFile(user.rcinfo -- file:///Users/abc/Documents/harness/IOS_dev/featureBT11915XCREMOTECACHE_nonprod_dev/mono-ios/abc-ios-mobile/). Skipping extra configuration
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.441 I xcprepare[60445:c9ae4d] Checking HTTP file HEAD for https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.441 I xcprepare[60445:c9ae4d] Making request https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.638 I xcprepare[60445:c9ae5c] Network request failed with unsuccessful code 404
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.638 I xcprepare[60445:c9ae4d] Checking HTTP file HEAD for https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.638 I xcprepare[60445:c9ae4d] Making request https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.667 I xcprepare[60445:c9ae5c] Network request failed with unsuccessful code 404
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.667 I xcprepare[60445:c9ae4d] Checking HTTP file HEAD for https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.667 I xcprepare[60445:c9ae4d] Making request https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.697 I xcprepare[60445:c9ae5c] Network request failed with unsuccessful code 404
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.980 I xcprepare[60445:c9ae4d] Checking HTTP file HEAD for https://cache-address-s3-bucket.com/cache/marker/c7033b9e57af702ab41c3781d2900f207d4f6dd5-Debug-iphonesimulator-13F100-5
INFO 2023-12-19 08:24:21 2023-12-19 08:19:43.980 I xcprepare[60445:c9ae4d] Making request https://cache-address-s3-bucket.com/cache/marker/c7033b9e57af702ab41c3781d2900f207d4f6dd5-Debug-iphonesimulator-13F100-5
INFO 2023-12-19 08:24:21 2023-12-19 08:19:44.012 I xcprepare[60445:c9ae5e] Network request failed with unsuccessful code 404
INFO 2023-12-19 08:24:21 2023-12-19 08:19:44.149 I xcprepare[60445:c9ae4d] No artifacts available
INFO 2023-12-19 08:24:21 2023-12-19 08:24:12.795 I xcprepare[64378:c9fb69] Extra config override failed with missingConfigurationFile(user.rcinfo -- file:///Users/abc/Documents/harness/IOS_dev/featureBT11915XCREMOTECACHE_nonprod_dev/mono-ios/abc-ios-mobile/). Skipping extra configuration
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.087 I xcprepare[64378:c9fb69] Checking HTTP file HEAD for https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.087 I xcprepare[64378:c9fb69] Making request https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.311 I xcprepare[64378:c9fb6c] Network request failed with unsuccessful code 404
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.311 I xcprepare[64378:c9fb69] Checking HTTP file HEAD for https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.311 I xcprepare[64378:c9fb69] Making request https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.344 I xcprepare[64378:c9fb6c] Network request failed with unsuccessful code 404
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.344 I xcprepare[64378:c9fb69] Checking HTTP file HEAD for https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.344 I xcprepare[64378:c9fb69] Making request https://cache-address-s3-bucket.com/cache/nginx-health
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.374 I xcprepare[64378:c9fb81] Network request failed with unsuccessful code 404
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.642 I xcprepare[64378:c9fb69] Checking HTTP file HEAD for https://cache-address-s3-bucket.com/cache/marker/c7033b9e57af702ab41c3781d2900f207d4f6dd5-Debug-iphonesimulator-13F100-5
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.642 I xcprepare[64378:c9fb69] Making request https://cache-address-s3-bucket.com/cache/marker/c7033b9e57af702ab41c3781d2900f207d4f6dd5-Debug-iphonesimulator-13F100-5
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.673 I xcprepare[64378:c9fb6a] Network request failed with unsuccessful code 404
INFO 2023-12-19 08:24:21 2023-12-19 08:24:13.810 I xcprepare[64378:c9fb69] No artifacts available
INFO 2023-12-19 08:24:35 DEVELOPER_DIR=/Applications/Xcode-14.1.app/Contents/Developer
INFO 2023-12-19 08:24:36 Command line invocation:
INFO 2023-12-19 08:24:36 /Applications/Xcode-14.1.app/Contents/Developer/usr/bin/xcodebuild -alltargets clean
INFO 2023-12-19 08:24:36 User defaults from command line:
INFO 2023-12-19 08:24:36 IDEPackageSupportUseBuiltinSCM = YES
INFO 2023-12-19 08:24:38

@polac24
Copy link
Collaborator

polac24 commented Dec 19, 2023

INFO 2023-12-19 08:24:21 2023-12-19 08:17:58.957 E xcprepare[58408:c98df5] XCRemoteCache's xcprepare failed to find git remote with [email protected]:h****/m*****.git address.Check that your git configuration (git remote -v) specifies it.

Is a key: the machine doesn't have h****/m*****.git remote in a git repo (verify with git remote -v)

@anuragstar
Copy link
Author

@polac24 I can see the cache key for this build configuration is present on the S3 bucket - cache/marker/b5bf12a367dabf0e2bff81305182570bb2203dd7-EnterpriseDev-iphonesimulator-14B47b-5

@polac24
Copy link
Collaborator

polac24 commented Dec 19, 2023

OK, but the client's machine doesn't have git remote pointing to the h****/m*****.git as expected. Probably there was a custom clone or a machine used different cloning method (e.g. https vs ssh). Invoke on that machien git remote -v and make sure the [email protected]:h****/mono-i****.git is on a list

@anuragstar
Copy link
Author

@polac24 Updated the git remote config and point to SSH mode, still consumer mode is failing with no artifact available,
One strange thing, I can see is the configuration is not picked as EnterpriseDev, instead it is trying to fetch artifact for DebugSimulator, can you please help what could be wrong here

git remote -v
output - [email protected]:h****/mono-i****.git

XCRC] XCRemoteCache disabled - no artifacts available
INFO 2023-12-19 21:30:12 Pod installation complete! There are 97 dependencies from the Podfile and 102 total pods installed.
INFO 2023-12-19 21:30:12
INFO 2023-12-19 21:30:12 [!] <PBXSourcesBuildPhase UUID=43353290265E67CA00EC4CB5> attempted to initialize an object with an unknown UUID. B125BCAC270B5CEF00AF6D57 for attribute: files. This can be the result of a merge and the unknown UUID is being discarded.
INFO 2023-12-19 21:30:12
INFO 2023-12-19 21:30:12 [!] Charts has been deprecated in favor of DGCharts
INFO 2023-12-19 21:30:12 Filtering the log data using "sender BEGINSWITH "xc""
INFO 2023-12-19 21:30:13 Timestamp Ty Process[PID:TID]
INFO 2023-12-19 21:30:13 2023-12-19 21:26:06.331 I xcprepare[1870:e05a41] Extra config override failed with missingConfigurationFile(user.rcinfo -- file:///Users/abctest3/Documents/harness/IOS_dev/featureBT11915XCREMOTECACHE_nonprod_dev/mono-ios/abcx-ios-mobile/). Skipping extra configuration
INFO 2023-12-19 21:30:13 2023-12-19 21:26:06.666 I xcprepare[1870:e05a41] Checking HTTP file HEAD for https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:26:06.666 I xcprepare[1870:e05a41] Making request https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:26:06.887 I xcprepare[1870:e05a56] Network request failed with unsuccessful code 404
INFO 2023-12-19 21:30:13 2023-12-19 21:26:06.887 I xcprepare[1870:e05a41] Checking HTTP file HEAD for https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:26:06.887 I xcprepare[1870:e05a41] Making request https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:26:06.921 I xcprepare[1870:e05a56] Network request failed with unsuccessful code 404
INFO 2023-12-19 21:30:13 2023-12-19 21:26:06.921 I xcprepare[1870:e05a41] Checking HTTP file HEAD for https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:26:06.921 I xcprepare[1870:e05a41] Making request https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:26:06.951 I xcprepare[1870:e05a56] Network request failed with unsuccessful code 404
INFO 2023-12-19 21:30:13 2023-12-19 21:26:07.226 I xcprepare[1870:e05a41] Checking HTTP file HEAD for https://abc.amazonaws.com/cache/marker/3b5ade88cf02ee75f4651155a5863b5734625c2d-Debug-iphonesimulator-13F100-5
INFO 2023-12-19 21:30:13 2023-12-19 21:26:07.226 I xcprepare[1870:e05a41] Making request https://abc.amazonaws.com/cache/marker/3b5ade88cf02ee75f4651155a5863b5734625c2d-Debug-iphonesimulator-13F100-5
INFO 2023-12-19 21:30:13 2023-12-19 21:26:07.260 I xcprepare[1870:e05a4e] Network request failed with unsuccessful code 404
INFO 2023-12-19 21:30:13 2023-12-19 21:26:07.406 I xcprepare[1870:e05a41] No artifacts available
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.189 I xcprepare[3380:e07dff] Extra config override failed with missingConfigurationFile(user.rcinfo -- file:///Users/abctest3/Documents/harness/IOS_dev/featureBT11915XCREMOTECACHE_nonprod_dev/mono-ios/abcx-ios-mobile/). Skipping extra configuration
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.405 I xcprepare[3380:e07dff] Checking HTTP file HEAD for https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.405 I xcprepare[3380:e07dff] Making request https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.620 I xcprepare[3380:e07e00] Network request failed with unsuccessful code 404
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.620 I xcprepare[3380:e07dff] Checking HTTP file HEAD for https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.620 I xcprepare[3380:e07dff] Making request https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.651 I xcprepare[3380:e07e02] Network request failed with unsuccessful code 404
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.651 I xcprepare[3380:e07dff] Checking HTTP file HEAD for https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.651 I xcprepare[3380:e07dff] Making request https://abc.amazonaws.com/cache/nginx-health
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.683 I xcprepare[3380:e07e02] Network request failed with unsuccessful code 404
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.967 I xcprepare[3380:e07dff] Checking HTTP file HEAD for https://abc.amazonaws.com/cache/marker/3b5ade88cf02ee75f4651155a5863b5734625c2d-Debug-iphonesimulator-13F100-5
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.967 I xcprepare[3380:e07dff] Making request https://abc.amazonaws.com/cache/marker/3b5ade88cf02ee75f4651155a5863b5734625c2d-Debug-iphonesimulator-13F100-5
INFO 2023-12-19 21:30:13 2023-12-19 21:30:07.998 I xcprepare[3380:e07e02] Network request failed with unsuccessful code 404
INFO 2023-12-19 21:30:13 2023-12-19 21:30:08.143 I xcprepare[3380:e07dff] No artifacts available
INFO 2023-12-19 21:30:26 DEVELOPER_DIR=/Applications/Xcode-14.1.app/Contents/Developer
INFO 2023-12-19 21:30:27 Command line invocation:
INFO 2023-12-19 21:30:27 /Applications/Xcode-14.1.app/Contents/Developer/usr/bin/xcodebuild -alltargets clean
INFO 2023-12-19 21:30:27 User defaults from command line:
INFO 2023-12-19 21:30:27

@anuragstar
Copy link
Author

anuragstar commented Dec 21, 2023

@polac24 what is the recommeded git checkout we need to do in github actions, what will be fetch depth in this case, Once I merged my code in CI, it starts failing in consumer mode, since it is merged first time in repo default branch, producer mode works fine

error: Prepare failed with error: Finding a common commit failed. Please try to call git fetch origin. [Error: statusError("status 128: fatal: Not a valid object name origin/development", 128)]
I tried setting up [email protected]:abc/abc-ios.git as in git global config, seems none of them are working

  • name: Checkout code
    uses: actions/checkout@v2
    with:
    fetch-depth: 0
    I can't set fetch-depth as 0, it will lead to increase in clone and checkout time

@polac24
Copy link
Collaborator

polac24 commented Dec 26, 2023

Your problem is probably caused by the actions/checkout@v2 optimization that only checkouts a single branch (this is discussed here).

Some comments there suggest trying something like but I didn't try it (note that main is the branch from which you build producer):

    steps:
      - uses: actions/checkout@v2
      - run: git fetch origin main

I didn't work with checkout versions v2+ and AFAIK, v1 checks out all branches by default.
If you find a working solution with @v2+, feel free to contribute to our docs.

@polac24
Copy link
Collaborator

polac24 commented Dec 26, 2023

Also, probably you need to set fetch-depth: to some value. That depends on your configuration of cache_commit_history in .rcinfo (by default it is 10).

Depending on the type of your PR merging strategy (rebase/merge/rebase+squash) you have to pick a right value. I suggest setting fetch-depth: 10 as a start.

@anuragstar
Copy link
Author

okay, let me try with fetch-depth:10, one more thing, In case of no artifact found from a particular branch, build is failing, Is there any way we can avoid build failure, and send as warning instead of build failure.

@polac24
Copy link
Collaborator

polac24 commented Jan 1, 2024

For the no artifact found: please create a new issue with full context and logs.

@anuragstar
Copy link
Author

anuragstar commented Feb 5, 2024

@polac24 We generated artifacts from development branch, and generated producer artifacts, it generate cache artifacts and upload to S3, when I run build in consumer mode it works perfectly.

When I cut a new branch from development -> test-XCRemoteCache, and run the builds in consumer mode from this branch it failed with this error, only difference in this branch and other branch is branchName is different, commit-id is same.

INFO 2024-02-05T11:42:29.758+0000 error: Prepare failed with error: Finding a common commit failed. Please try to call git fetch origin. [Error: statusError("status 128: fatal: Not a valid object name origin/development", 128)]

@polac24
Copy link
Collaborator

polac24 commented Feb 5, 2024

That looks like git merge-base origin/development HEAD didn't succeed on a CI machine. Please make sure the given branch (development) is available in that build.

@anuragstar
Copy link
Author

@polac24 On CI builds for AppStores we are checking out branch and clone via this way to reduce checkout & clone time
git clone [email protected]:abc/${RepoName} --branch "${BRANCH}" --single-branch --depth 20 ${RepoName}

@polac24
Copy link
Collaborator

polac24 commented Feb 5, 2024

that is a reason: XCRemoteCache needs having primary_branch (probably development for you) to work.

@anuragstar
Copy link
Author

@polac24 The new branch is already cut from development, so it's already in sync with development, can we handle this issue as cache miss, instead of build failure, after enabling this suddenly all the builds which triggers from CI using feature branches and release-* branches starts failing.

@anuragstar
Copy link
Author

anuragstar commented Feb 5, 2024

@polac24 I understand, there is a primary branch in Podfile, .rcinfo file, which is pointing to development in our case, The issue is any branch cut from a development or release-branch cut from a development, which is even 1-2 commit ahead but that leads to failure with this reason - Prepare failed with error: Finding a common commit failed. Please try to call git fetch origin

Can it be handle by using flag at your end - handle-common-commit-not-found : true/false, by default you can set false at your end, in case anyone want to use this functionality, they can leverage it.

@polac24
Copy link
Collaborator

polac24 commented Feb 5, 2024

We don't have such official flag (open for contributions), but there is a potential workaround.

Potential workaround:

xcprepare creates remote_commit_file (default build/remote-cache/arc.rc) that contains a sha to reuse. You could try to create it manually, but most likely the automatic cocoapods-flow might not work out of a box - you need to analyze what happens in the flow to understand on which step you can create that file.

@polac24
Copy link
Collaborator

polac24 commented Feb 5, 2024

Another workaround: set primary_branch: release-CURRENT_BRANCH for your release builds.

@anuragstar
Copy link
Author

anuragstar commented Feb 5, 2024

@polac24 I already tried, by overriding a primary_branch if the build trigger is not from a development branch, setting primary_branch in Podfile & .rcinfo that worked now.
Want to understand one more point, what is the best value of artifact_maximum_age for CI jobs need to be configured.

@polac24
Copy link
Collaborator

polac24 commented Feb 5, 2024

"best value" might be 10 if you have merge commits on a "main" branch. If you commit with rebase without squashing, you may increase it ~50 (depending on the traffic of merged PRs).

@anuragstar
Copy link
Author

anuragstar commented Feb 5, 2024

@polac24 artifact_maximum_age is maximum age for which artifacts will be retained, right now we have configured
artifact_maximum_age : 0 for CI runs, let me know do we need to change it ?

@polac24
Copy link
Collaborator

polac24 commented Feb 6, 2024

regarding artifact_maximum_age problems, please create a separate issue. This one apparently is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants