SwiftLint: Xcode 15 Beta 8 + Xcode Cloud Error
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Describe the bug
Hello. We are utilizing the SwiftLint plugin as a build phase in our project containing:
- iOS App Target
- iOS App Clip Target
When building with Xcode Cloud using Xcode Beta (8 in this case) a build error is encountered related to SwiftLint.
2023-09-05T18:13:05.391803418Z 2023-09-05 11:12:56.500 xcodebuild[10687:38398] DVTFilePathFSEvents: Failed to start fs event stream.
2023-09-05T18:13:05.391812273Z Error: You don’t have permission to save the file “f50a50e51ef5bdd780b98209347c4360c491f7299bcc424e3316162e78de3c24.plist” in the folder “478B1767-7422-3827-9D90-A09D769C708F”.
2023-09-05T18:13:05.391819938Z
2023-09-05T18:13:05.391824842Z /usr/bin/sandbox-exec -p "(version 1)
2023-09-05T18:13:05.391830105Z (deny default)
2023-09-05T18:13:05.391849244Z (import \"system.sb\")
2023-09-05T18:13:05.391854386Z (allow file-read*)
2023-09-05T18:13:05.391859099Z (allow process*)
2023-09-05T18:13:05.391863573Z (allow file-write*
2023-09-05T18:13:05.391886045Z (subpath \"/private/tmp\")
2023-09-05T18:13:05.391896318Z (subpath \"/private/var/folders/x7/fs459gdd67132_hw5t3cz_s00000gn/T\")
2023-09-05T18:13:05.391913502Z )
2023-09-05T18:13:05.391918327Z (deny file-write*
2023-09-05T18:13:05.391923035Z (subpath \"/Volumes/workspace/repository\")
2023-09-05T18:13:05.391928353Z )
2023-09-05T18:13:05.391933923Z (allow file-write*
2023-09-05T18:13:05.391938967Z (subpath \"/Volumes/workspace/DerivedData/SourcePackages/plugins/**REDACTED**.output/**REDACTED**/SwiftLintPlugin\")
2023-09-05T18:13:05.453548242Z 2023-09-05 11:12:56.602 xcodebuild[10689:38404] DVTFilePathFSEvents: Failed to start fs event stream.
2023-09-05T18:13:05.453557706Z Error: You don’t have permission to save the file “f50a50e51ef5bdd780b98209347c4360c491f7299bcc424e3316162e78de3c24.plist” in the folder “478B1767-7422-3827-9D90-A09D769C708F”.
Additionally, our ci_post_clone script contains defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES
Xcode Cloud Environment is set to:
- Latest or Beta Release Xcode
- Latest or Beta Release macOS
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
Environment
- SwiftLint version (run
swiftlint versionto be sure)? - Installation method used (Homebrew, CocoaPods, building from source, etc)?
- Paste your configuration file:
# insert yaml contents here
- Are you using nested configurations? If so, paste their relative paths and respective contents.
- Which Xcode version are you using (check
xcodebuild -version)? - Do you have a sample that shows the issue? Run
echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rulesto quickly test if your example is really demonstrating the issue. If your example is more complex, you can useswiftlint lint --path [file here] --no-cache --enable-all-rules.
// This triggers a violation:
let foo = try! bar()
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 14
- Comments: 17
Commits related to this issue
- #5205 Explicitely disable cache for SwiftLintPlugin runs on Xcode Cloud In Xcode Cloud environment, SwiftLint’s cache cannot be written. When using the SwiftLinkPlugin, there is no way to disable the... — committed to evehome/SwiftLint by slavikus 8 months ago
- Disable SwiftLint build step for xcode cloud builds to work Watching this issue to re-enable SwiftLint https://github.com/realm/SwiftLint/issues/5205 — committed to po-gl/Pomodoro by po-gl 8 months ago
Facing the same issue.
Doesn’t matter if we use different macOS versions so must be something in Xcode 15.
Same issue here
I’m also facing the same issue. I have Swiftlint installed via SPM. It works locally but not on Xcode Cloud.
We are seeing the same issue with Xcode 15 RC (15A240d) and macOS Sonoma 14 RC (23A339) on Xcode Cloud.
Same issue here
I filed the above as a new issue (#5448) because I believe the package plugin variant of using SwiftLint may have been overlooked during the earlier fixes for Xcode Cloud.
Fixed by #5287.
Having this problem as well, and I’m guessing the reason that isLikelyXcodeCloudEnvironment is no longer working has something to do with the
CI_WORKSPACEenvironment variable it references being deprecated. In my custom scripts that I haven’t had a chance to update yet, I’m seeing the following warning:Found usage of deprecated environment variable CI_WORKSPACE. Use CI_PRIMARY_REPOSITORY_PATH insteadIt doesn’t quite make sense why
isLikelyXcodeCloudEnvironmentwould fail due to this deprecation though - from everything I can see that environment variable is still set, and theisLikelyXcodeCloudEnvironmentsimply checks for it’s existence - but it does seem a bit too coincidental to not be related.Ran into this as well. The only way I could get it to work was to hack swiftlint so isLikelyXcodeCloudEnvironment always returned true (and jump through the hoops to host my own binary of it). I couldn’t figure out how to get logs out of it when running on Xcode Cloud so I’m not sure why that function isn’t returning true when it should. As far as I can tell all the right things are in the environment.
Edited to add: I thought I had tried this before but I guess it failed for a different reason. But changing SwiftLintPlugin to pass “–no-cache” as an argument also is sufficient to fix the problem, further evidence, I think, that isLikelyXcodeCloudEnvironment is no longer able to correctly detect Xcode Cloud builds.