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

Container exits immediately when used as a service in GitHub Actions since v108 #255

Open
mihkeleidast opened this issue Jul 25, 2024 · 1 comment
Labels

Comments

@mihkeleidast
Copy link

Describe the bug
When using this container in GitHub Actions as a service, it exits immediately after starting since version 108, example: https://github.com/mihkeleidast/chromium-service-container-debug/blob/main/.github/workflows/test.yml

It works as expected (e.g. container stays running in the background) until version 102, example: https://github.com/mihkeleidast/chromium-service-container-debug/actions/runs/10083423138/job/27879954595

To Reproduce
Steps to reproduce the behavior:

  1. Fork and run https://github.com/mihkeleidast/chromium-service-container-debug/blob/main/.github/workflows/test.yml

What is the expected behavior?
Container should stay running in the background so I can run tests via puppeteer in the main runner.

What is the actual behavior?
Container exits immediately after starting.

Possible solution
I don't know if it helps much, but for example chromedp/headless-shell stays running as expected if used in the same way.

Logs

From the test run:

2024-07-24T21:23:59.9505348Z Current runner version: '2.317.0'
2024-07-24T21:23:59.9529213Z ##[group]Operating System
2024-07-24T21:23:59.9529832Z Ubuntu
2024-07-24T21:23:59.9530283Z 22.04.4
2024-07-24T21:23:59.9530566Z LTS
2024-07-24T21:23:59.9530895Z ##[endgroup]
2024-07-24T21:23:59.9531353Z ##[group]Runner Image
2024-07-24T21:23:59.9531742Z Image: ubuntu-22.04
2024-07-24T21:23:59.9532136Z Version: 20240721.1.0
2024-07-24T21:23:59.9533191Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20240721.1/images/ubuntu/Ubuntu2204-Readme.md
2024-07-24T21:23:59.9534572Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20240721.1
2024-07-24T21:23:59.9535417Z ##[endgroup]
2024-07-24T21:23:59.9535892Z ##[group]Runner Image Provisioner
2024-07-24T21:23:59.9536326Z 2.0.373.1
2024-07-24T21:23:59.9536673Z ##[endgroup]
2024-07-24T21:23:59.9537659Z ##[group]GITHUB_TOKEN Permissions
2024-07-24T21:23:59.9539168Z Contents: read
2024-07-24T21:23:59.9539707Z Metadata: read
2024-07-24T21:23:59.9540234Z Packages: read
2024-07-24T21:23:59.9540794Z ##[endgroup]
2024-07-24T21:23:59.9543633Z Secret source: Actions
2024-07-24T21:23:59.9544235Z Prepare workflow directory
2024-07-24T21:24:00.0410761Z Prepare all required actions
2024-07-24T21:24:00.1005471Z Complete job name: run test
2024-07-24T21:24:00.1753898Z ##[group]Checking docker version
2024-07-24T21:24:00.1769044Z ##[command]/usr/bin/docker version --format '{{.Server.APIVersion}}'
2024-07-24T21:24:00.2924194Z '1.45'
2024-07-24T21:24:00.2934560Z Docker daemon API version: '1.45'
2024-07-24T21:24:00.2935484Z ##[command]/usr/bin/docker version --format '{{.Client.APIVersion}}'
2024-07-24T21:24:00.3099328Z '1.45'
2024-07-24T21:24:00.3112576Z Docker client API version: '1.45'
2024-07-24T21:24:00.3118155Z ##[endgroup]
2024-07-24T21:24:00.3121211Z ##[group]Clean up resources from previous jobs
2024-07-24T21:24:00.3127649Z ##[command]/usr/bin/docker ps --all --quiet --no-trunc --filter "label=7edf2b"
2024-07-24T21:24:00.3464137Z ##[command]/usr/bin/docker network prune --force --filter "label=7edf2b"
2024-07-24T21:24:00.3590831Z ##[endgroup]
2024-07-24T21:24:00.3591448Z ##[group]Create local container network
2024-07-24T21:24:00.3602215Z ##[command]/usr/bin/docker network create --label 7edf2b github_network_c6cc527c6b8b45c59fcdce940da47f7b
2024-07-24T21:24:00.4178333Z 9050db3aa8d48f009ad544543bd2ee40b9c2ca371457f17b3f548658804d2eee
2024-07-24T21:24:00.4207343Z ##[endgroup]
2024-07-24T21:24:00.4321425Z ##[group]Starting puppeteer service container
2024-07-24T21:24:00.4387068Z ##[command]/usr/bin/docker pull zenika/alpine-chrome:124
2024-07-24T21:24:00.7569257Z 124: Pulling from zenika/alpine-chrome
2024-07-24T21:24:00.8205598Z b84a74cde5af: Already exists
2024-07-24T21:24:00.8231893Z 9072fde31221: Pulling fs layer
2024-07-24T21:24:00.8233007Z c41a98b58a4e: Pulling fs layer
2024-07-24T21:24:00.8233849Z 73c37ec576f5: Pulling fs layer
2024-07-24T21:24:00.8234746Z 4f4fb700ef54: Pulling fs layer
2024-07-24T21:24:00.8235951Z 4f4fb700ef54: Waiting
2024-07-24T21:24:00.9240672Z 73c37ec576f5: Verifying Checksum
2024-07-24T21:24:00.9242295Z 73c37ec576f5: Download complete
2024-07-24T21:24:00.9422359Z c41a98b58a4e: Verifying Checksum
2024-07-24T21:24:00.9423476Z c41a98b58a4e: Download complete
2024-07-24T21:24:01.0112412Z 4f4fb700ef54: Verifying Checksum
2024-07-24T21:24:01.0113401Z 4f4fb700ef54: Download complete
2024-07-24T21:24:03.4007726Z 9072fde31221: Verifying Checksum
2024-07-24T21:24:03.4008604Z 9072fde31221: Download complete
2024-07-24T21:24:08.4167478Z 9072fde31221: Pull complete
2024-07-24T21:24:08.4300589Z c41a98b58a4e: Pull complete
2024-07-24T21:24:08.4756605Z 73c37ec576f5: Pull complete
2024-07-24T21:24:08.4893659Z 4f4fb700ef54: Pull complete
2024-07-24T21:24:08.4941816Z Digest: sha256:d9921bb165802509ae1765c0cb953927ae93cebf77c1be03139202277c34446b
2024-07-24T21:24:08.4958918Z Status: Downloaded newer image for zenika/alpine-chrome:124
2024-07-24T21:24:08.4967228Z docker.io/zenika/alpine-chrome:124
2024-07-24T21:24:08.5070019Z ##[command]/usr/bin/docker create --name 21f2ad167e1747c49d910ef8505fa74f_zenikaalpinechrome124_ad3d2f --label 7edf2b --network github_network_c6cc527c6b8b45c59fcdce940da47f7b --network-alias puppeteer -p 9222:9222 --cap-add=SYS_ADMIN -e "CHROMIUM_FLAGS=--log-level=0 --headless --disable-gpu --disable-software-rasterizer --no-sandbox --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 --disable-setuid-sandbox --disable-dev-shm-usage --single-process --hide-scrollbars --font-render-hinting=medium --use-gl=swiftshader" -e GITHUB_ACTIONS=true -e CI=true zenika/alpine-chrome:124
2024-07-24T21:24:08.5359375Z e1864ca560ae63843bdcea2673e23ae1157e5a3531b8c52a77e549c4aeb6cd53
2024-07-24T21:24:08.5382724Z ##[command]/usr/bin/docker start e1864ca560ae63843bdcea2673e23ae1157e5a3531b8c52a77e549c4aeb6cd53
2024-07-24T21:24:08.8142995Z e1864ca560ae63843bdcea2673e23ae1157e5a3531b8c52a77e549c4aeb6cd53
2024-07-24T21:24:08.8168327Z ##[command]/usr/bin/docker ps --all --filter id=e1864ca560ae63843bdcea2673e23ae1157e5a3531b8c52a77e549c4aeb6cd53 --filter status=running --no-trunc --format "{{.ID}} {{.Status}}"
2024-07-24T21:24:08.8292891Z e1864ca560ae63843bdcea2673e23ae1157e5a3531b8c52a77e549c4aeb6cd53 Up Less than a second
2024-07-24T21:24:08.8314105Z ##[command]/usr/bin/docker port e1864ca560ae63843bdcea2673e23ae1157e5a3531b8c52a77e549c4aeb6cd53
2024-07-24T21:24:08.8429375Z 9222/tcp -> 0.0.0.0:9222
2024-07-24T21:24:08.8430052Z 9222/tcp -> [::]:9222
2024-07-24T21:24:08.8503901Z ##[endgroup]
2024-07-24T21:24:08.8529010Z ##[group]Waiting for all services to be ready
2024-07-24T21:24:08.8564673Z ##[command]/usr/bin/docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" e1864ca560ae63843bdcea2673e23ae1157e5a3531b8c52a77e549c4aeb6cd53
2024-07-24T21:24:08.8693267Z puppeteer service is healthy.
2024-07-24T21:24:08.8693786Z ##[endgroup]
2024-07-24T21:24:08.9089182Z ##[group]Run sleep 10s
2024-07-24T21:24:08.9089630Z �[36;1msleep 10s�[0m
2024-07-24T21:24:08.9166485Z shell: /usr/bin/bash -e {0}
2024-07-24T21:24:08.9166884Z ##[endgroup]
2024-07-24T21:24:18.9536966Z ##[group]Run docker ps -a
2024-07-24T21:24:18.9537542Z �[36;1mdocker ps -a�[0m
2024-07-24T21:24:18.9591033Z shell: /usr/bin/bash -e {0}
2024-07-24T21:24:18.9591497Z ##[endgroup]
2024-07-24T21:24:18.9803267Z CONTAINER ID   IMAGE                      COMMAND                  CREATED          STATUS                     PORTS     NAMES
2024-07-24T21:24:18.9805334Z e1864ca560ae   zenika/alpine-chrome:124   "chromium-browser --…"   10 seconds ago   Exited (0) 9 seconds ago             21f2ad167e1747c49d910ef8505fa74f_zenikaalpinechrome124_ad3d2f
2024-07-24T21:24:18.9836375Z ##[group]Run curl http://127.0.0.1:9222/json/version
2024-07-24T21:24:18.9837137Z �[36;1mcurl http://127.0.0.1:9222/json/version�[0m
2024-07-24T21:24:18.9889349Z shell: /usr/bin/bash -e {0}
2024-07-24T21:24:18.9889869Z ##[endgroup]
2024-07-24T21:24:19.0034058Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2024-07-24T21:24:19.0035178Z                                  Dload  Upload   Total   Spent    Left  Speed
2024-07-24T21:24:19.0036017Z 
2024-07-24T21:24:19.0036735Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2024-07-24T21:24:19.0037889Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2024-07-24T21:24:19.0039006Z curl: (7) Failed to connect to 127.0.0.1 port 9222 after 0 ms: Connection refused
2024-07-24T21:24:19.0056613Z ##[error]Process completed with exit code 7.
2024-07-24T21:24:19.0118313Z Print service container logs: 21f2ad167e1747c49d910ef8505fa74f_zenikaalpinechrome124_ad3d2f
2024-07-24T21:24:19.0123462Z ##[command]/usr/bin/docker logs --details e1864ca560ae63843bdcea2673e23ae1157e5a3531b8c52a77e549c4aeb6cd53
2024-07-24T21:24:19.0366361Z  [0724/212409.200193:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
2024-07-24T21:24:19.0368158Z  [0724/212409.201098:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
2024-07-24T21:24:19.0369882Z  [0724/212409.201140:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
2024-07-24T21:24:19.0371146Z  [0724/212409.222182:WARNING:sandbox_linux.cc(420)] InitializeSandbox() called with multiple threads in process gpu-process.
2024-07-24T21:24:19.0372679Z  [0724/212409.233256:INFO:config_dir_policy_loader.cc(118)] Skipping mandatory platform policies because no policy file was found at: /etc/chromium/policies/managed
2024-07-24T21:24:19.0374120Z  [0724/212409.233277:INFO:config_dir_policy_loader.cc(118)] Skipping recommended platform policies because no policy file was found at: /etc/chromium/policies/recommended
2024-07-24T21:24:19.0375470Z  [0724/212409.243287:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
2024-07-24T21:24:19.0377025Z  [0724/212409.245594:WARNING:runtime_features.cc(730)] AttributionReportingCrossAppWeb cannot be enabled in this configuration. Use --enable-features=ConversionMeasurement,AttributionReportingCrossAppWeb in addition.
2024-07-24T21:24:19.0384870Z Stop and remove container: 21f2ad167e1747c49d910ef8505fa74f_zenikaalpinechrome124_ad3d2f
2024-07-24T21:24:19.0390286Z ##[command]/usr/bin/docker rm --force e1864ca560ae63843bdcea2673e23ae1157e5a3531b8c52a77e549c4aeb6cd53
2024-07-24T21:24:19.0552297Z e1864ca560ae63843bdcea2673e23ae1157e5a3531b8c52a77e549c4aeb6cd53
2024-07-24T21:24:19.0575338Z Remove container network: github_network_c6cc527c6b8b45c59fcdce940da47f7b
2024-07-24T21:24:19.0580909Z ##[command]/usr/bin/docker network rm github_network_c6cc527c6b8b45c59fcdce940da47f7b
2024-07-24T21:24:19.3213496Z github_network_c6cc527c6b8b45c59fcdce940da47f7b
2024-07-24T21:24:19.3375801Z Cleaning up orphan processes

Versions
See in the logs above.

Additional context

I tried various different settings and options, but could not get it to keep running on newer versions. Any pointers appreciated.

@mihkeleidast
Copy link
Author

mihkeleidast commented Jul 26, 2024

Okay, I at least figured out a workaround.

Something seems to have happened to how the CHROMIUM_FLAGS env variable is passed forward, as that's what has stopped working in the same way.

The flags work if passed as args/command to the image, but that is not possible yet with GitHub Actions service containers.

So I tested If perhaps I can just run the container manually... and it works! Example run: https://github.com/mihkeleidast/chromium-service-container-debug/actions/runs/10106859331/job/27949698933

I would still appreciate if someone looked at why the env variable is no longer respected

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

No branches or pull requests

1 participant