-
Notifications
You must be signed in to change notification settings - Fork 636
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
[GitHub Actions] Failed to initialize container on ubuntu-latest
with SwiftFormat
0.55.2
#1930
Comments
Thank you a lot for this great project which makes working in a team so much easier and effective! Sadly at the moment I experience the same Issue as the original poster. ErrorChecking docker version
Clean up resources from previous jobs
Create local container network
Starting job container
/usr/bin/docker --config /home/runner/work/_temp/.docker_d7c9b40f-9dda-4978-b15b-4da8425b8f50 login ghcr.io -u david-walter-naptics --password-stdin
/usr/bin/docker --config /home/runner/work/_temp/.docker_d7c9b40f-9dda-4978-b15b-4da8425b8f50 pull ghcr.io/nicklockwood/swiftformat:latest
latest: Pulling from nicklockwood/swiftformat
5ec304e2e8a2: Pulling fs layer
5ec304e2e8a2: Verifying Checksum
5ec304e2e8a2: Download complete
5ec304e2e8a2: Pull complete
Digest: sha256:1308256e5b6bf0efef0d8d07abe460c7e595b01c2b9fbea8d616d3083f9ee59c
Status: Downloaded newer image for ghcr.io/nicklockwood/swiftformat:latest
ghcr.io/nicklockwood/swiftformat:latest
/usr/bin/docker create --name 557f75af22b042c6a70cf37730185027_ghcrionicklockwoodswiftformatlatest_b41db7 --label 6536e6 --workdir /__w/heim-app-ios/heim-app-ios --network github_network_67ca9aa9873346df89f2d0f080fe92ed --entrypoint '' -e "HOME=/github/home" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work":"/__w" -v "/home/runner/runners/2.320.0/externals":"/__e":ro -v "/home/runner/work/_temp":"/__w/_temp" -v "/home/runner/work/_actions":"/__w/_actions" -v "/opt/hostedtoolcache":"/__t" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" --entrypoint "tail" ghcr.io/nicklockwood/swiftformat:latest "-f" "/dev/null"
5faba1a735a294728a4ca24e77083547fc3a5eac467b6ef6b9564535aa28ab36
/usr/bin/docker start 5faba1a735a294728a4ca24e77083547fc3a5eac467b6ef6b9564535aa28ab36
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "tail": executable file not found in $PATH: unknown
Error: failed to start containers: 5faba1a735a294728a4ca24e77083547fc3a5eac467b6ef6b9564535aa28ab36
Error: Docker start fail with exit code 1 Workflowname: Swiftformat
run-name: Swiftformat
on:
workflow_call:
jobs:
swiftformat:
runs-on: ubuntu-latest
container:
image: ghcr.io/nicklockwood/swiftformat:latest
options: "--entrypoint ''" # Prevent run of swiftformat before repo is checked out
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Printing swiftformat version
run: swiftformat --version
- name: Running swiftformat
run: swiftformat --lint . |
@csjones @Cyberbeni could this be related to your Linux build changes? Would you mind taking a look? |
From the log, it seems like GHA changes the entrypoint to Line 16 in eb55d16
PS: Using the docker container locally with docker works on an Intel J4105 PC, using the container with podman on a Ryzen 1700x PC sometimes returns error code 139 (SIGSEGV) but not when --verbose mode is enabled, both on 0.55.0, 0.55.2 and local build; 0.54.5 seems to work on both. I will try installing docker on the Ryzen PC and podman on the Intel PC later. |
The Intel PC with podman seems to work fine. (It is running Ubuntu server 20.04) So the problem is specific to the Ryzen 1700x PC, which is using Nobara 40. (Haven't had time to try docker on this machine yet) |
Ah, don't need to install docker, I can just get the binary from the artifactbundle. > ~/Downloads/swiftformat_linux .
Running SwiftFormat...
Reading config file at /home/cyberbeni/Developer/Wiring/.swiftformat
[1] 6165 segmentation fault (core dumped) ~/Downloads/swiftformat_linux . But still not crashing when using verbose mode: > ~/Downloads/swiftformat_linux --verbose .
Running SwiftFormat...
Reading config file at /home/cyberbeni/Developer/Wiring/.swiftformat
...
SwiftFormat completed in 0.16s.
0/31 files formatted. So this seems like an issue with the Swift static Linux SDK. Will write up a bug report for them later today. |
swiftformat_linux.zip still contains the version that links against dependency versions that are found on Ubuntu 20.04, I think that can be removed (or replaced with the same output as the artifactbundle build) |
@Cyberbeni the zipped version is built using the linux_build action rather than the artifactbundle action. Perhaps these can be unified? |
Yes, the swiftformat_linux.zip currently only runs properly on Ubuntu 20.04 (or systems that use the same versions for the runtime dependencies) |
Also I just noticed that The 0.55.0 container has no stripping, so this shouldn't be the cause of the problem. Relevant Apple docs: https://developer.apple.com/documentation/xcode/build-settings-reference#Strip-Style |
@ski-u Could you try this image? Here are the changes compared to main: https://github.com/Cyberbeni/SwiftFormat/commit/0e0ee6cf589d5b0d6078f6c22d6dbb30b3bada06 |
@Cyberbeni Thank you for the investigation! I tried the new image here Run actions/checkout@v4
with:
repository: ski-u/SwiftFormatWithGitHubActions
token: ***
ssh-strict: true
ssh-user: git
persist-credentials: true
clean: true
sparse-checkout-cone-mode: true
fetch-depth: 1
fetch-tags: false
show-progress: true
lfs: false
submodules: false
set-safe-directory: true
/usr/bin/docker exec 3afffe4b3b05991cc8f3b9e0d31[2](https://github.com/ski-u/SwiftFormatWithGitHubActions/actions/runs/12041026502/job/33572291480#step:3:2)6f46541f641b[3](https://github.com/ski-u/SwiftFormatWithGitHubActions/actions/runs/12041026502/job/33572291480#step:3:3)e921a822916fe6643922589 sh -c "cat /etc/*release | grep ^ID"
/__e/node20/bin/node: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory |
So they copy over a dynamically linked node to run actions which then doesn't find its dependencies. Is there no documentation on the minimal base image for GHA? I couldn't find anything on this. Also I'm not sure if this should be a supported use case. I'm pretty sure you can just run |
I'm horribly out of my depth here so I'm going to let you guys figure it out. Let me know if I need to revert anything or replace any of the binaries attached to the release |
I tried BTW, |
Based on the code I think you have to pass this to docker: So https://github.com/nicklockwood/SwiftFormat/blob/main/Sources/GithubActionsLogReporter.swift Then this could probably be added to the readme: https://github.com/nicklockwood/SwiftFormat?tab=readme-ov-file#github-actions |
That's what I need, thank you for the feedback. But I found that command failed with Run docker run --rm --volume=.:/workspace --env GITHUB_WORKSPACE=/workspace ghcr.io/nicklockwood/swiftformat:0.55.3 /workspace --lint --lenient --reporter github-actions-log
Unable to find image 'ghcr.io/nicklockwood/swiftformat:0.55.3' locally
0.55.3: Pulling from nicklockwood/swiftformat
d3a[4](https://github.com/ski-u/SwiftFormatWithGitHubActions/actions/runs/12114190729/job/33770333939?pr=5#step:3:5)026919f9: Pulling fs layer
3a7100a6b2df: Pulling fs layer
d3a4026919f9: Verifying Checksum
d3a4026919f9: Download complete
3a7100a6b2df: Verifying Checksum
3a7100a6b2df: Download complete
d3a4026919f9: Pull complete
3a7100a6b2df: Pull complete
Digest: sha2[5](https://github.com/ski-u/SwiftFormatWithGitHubActions/actions/runs/12114190729/job/33770333939?pr=5#step:3:6)6:68f92025cfb0cdb6d60dc235489215f79936de3783a2b1c2b1f22e40[6](https://github.com/ski-u/SwiftFormatWithGitHubActions/actions/runs/12114190729/job/33770333939?pr=5#step:3:7)17f13c8
Status: Downloaded newer image for ghcr.io/nicklockwood/swiftformat:0.55.3
Running SwiftFormat...
(lint mode - no files will be changed.)
Error: Process completed with exit code 13[9](https://github.com/ski-u/SwiftFormatWithGitHubActions/actions/runs/12114190729/job/33770333939?pr=5#step:3:10). |
@ski-u hopefully fixed 0.55.4? Let me know if not |
Hey @nicklockwood! I'm still seeing this issue with 0.55.4. You can see the most recent failures below. Interestingly, they're different errors, and I see them across the two latest Ubuntu runners (22.04 and 24.04). For context, I was running SwiftFormat via Docker image, and I wasn't having any issues until 0.55.x. As a workaround, I'm simply using the pre-installed version on GitHub's macOS runners. Docker and Linux is out of my wheelhouse, so I don't know how to resolve this, but I would be interested to know the fix. It'd likely be helpful for my own work on xcbeautify. If it's any help, I noticed that previous versions (before 0.55.x) shipped images for 3 Linux architectures (see here), while the later ones only ship 2 (see here). I'm not sure if that's related, but it is the one difference that stuck out to me. Thanks, and I hope this helps find a fix! |
I am using a self-hosted runner with Ubuntu 22.04 and still seeing the same error for 0.55.4:
Workflow: jobs:
format:
runs-on: my-ubuntu-runner
container: ghcr.io/nicklockwood/swiftformat:0.55.4
steps:
- uses: actions/checkout@v4
- name: SwiftFormat
run: swiftformat --lint . --reporter github-actions-log It worked well before |
Now it works well for me with jobs:
swiftformat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: swiftformat
run: docker run --rm --volume=.:/workspace --env GITHUB_WORKSPACE=/workspace ghcr.io/nicklockwood/swiftformat:0.55.4 /workspace --lint --lenient --reporter github-actions-log |
@ski-u Thanks, it worked! Although I tried this yesterday and the build got stuck, it now works for several tests. |
@ealeksandrov @Cyberbeni
|
Hi, thank you for working on this project! 👋
I'm using
SwiftFormat
on GitHub Actions and found the container initialization fails onubuntu-latest
with the latestSwiftFormat
(0.55.2)I didn't have this issue before 0.55.0.
Reproduce
SwiftFormat
Initialize containers
stepInitialize containers
stepError
Workflow
The text was updated successfully, but these errors were encountered: