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

Test containers cannot be used in local workflow execution (Scala / SBT project) #501

Closed
pbartusch opened this issue Jan 23, 2021 · 5 comments
Labels

Comments

@pbartusch
Copy link

Hi,

I encountered a problem using act while testing the deployment workflow of my project (https://github.com/querqy/smui/) locally. I already came across the following issues, describing how to use a "full" local build container:

Steps to reproduce:

Unexpected behaviour:

Setting the experimental mode for the docker service in the build environment fails:

[dockerhub-deployment/test-build-push] ⭐  Run Docker restart (with experimental status)
| rm: cannot remove '/etc/docker/daemon.json': No such file or directory
| { "experimental": true }
| docker: unrecognized service
[dockerhub-deployment/test-build-push]   ❌  Failure - Docker restart (with experimental status)
Error: exit with `FAILURE`: 1

On github that step performs well.

Even, when commenting out this step (as experimental seems to be activated for that build container), the tests from the project that rely on test containers will fail (e.g. MysqlCompatibilitySpec and PostgresCompatibilitySpec).

| [warn] o.t.u.RegistryAuthLocator - Failure when attempting to lookup auth config (dockerImageName: alpine:3.5, configFile: /root/.docker/config.json. Falling back to docker-java default behaviour. Exception message: /root/.docker/config.json (No such file or directory)
| [info] MysqlCompatibilitySpec:
| [info] models.MysqlCompatibilitySpec *** ABORTED ***
| [info]   com.github.dockerjava.api.exception.NotFoundException: {"message":"No such image: alpine:3.5"}
| [info]   at org.testcontainers.dockerclient.transport.okhttp.OkHttpInvocationBuilder.execute(OkHttpInvocationBuilder.java:270)
| [info]   at org.testcontainers.dockerclient.transport.okhttp.OkHttpInvocationBuilder.execute(OkHttpInvocationBuilder.java:254)
| [info]   at org.testcontainers.dockerclient.transport.okhttp.OkHttpInvocationBuilder.post(OkHttpInvocationBuilder.java:125)
| [info]   at com.github.dockerjava.core.exec.CreateContainerCmdExec.execute(CreateContainerCmdExec.java:33)
| [info]   at com.github.dockerjava.core.exec.CreateContainerCmdExec.execute(CreateContainerCmdExec.java:13)
| [info]   at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
| [info]   at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
| [info]   at com.github.dockerjava.core.command.CreateContainerCmdImpl.exec(CreateContainerCmdImpl.java:1139)
| [info]   at org.testcontainers.DockerClientFactory.runInsideDocker(DockerClientFactory.java:252)
| [info]   at org.testcontainers.DockerClientFactory.runInsideDocker(DockerClientFactory.java:244)
| [info]   ...

Again, on github that step performs well.

I saw the same error when using the full suffixed build system:

act -P ubuntu-latest=nektos/act-environments-ubuntu:18.04-full

My impression is that the github build environment (container) and the container act uses, differ too much for the described use case.

@github-actions
Copy link
Contributor

Issue is stale and will be closed in 14 days unless there is new activity

@McPringle
Copy link

GitHub actions with a Maven build using the Testcontainers framework work fine on GitHub itself but fail using act:

| [WARNING] Can not connect to Ryuk at 172.17.0.1:18499
| java.net.ConnectException: Connection refused
|     at sun.nio.ch.Net.pollConnect (Native Method)
|     at sun.nio.ch.Net.pollConnectNow (Net.java:672)
|     at sun.nio.ch.NioSocketImpl.timedFinishConnect (NioSocketImpl.java:542)
|     at sun.nio.ch.NioSocketImpl.connect (NioSocketImpl.java:597)
|     at java.net.SocksSocketImpl.connect (SocksSocketImpl.java:327)
|     at java.net.Socket.connect (Socket.java:633)
|     at org.testcontainers.utility.RyukResourceReaper.lambda$null$0 (RyukResourceReaper.java:92)
|     at org.rnorth.ducttape.ratelimits.RateLimiter.doWhenReady (RateLimiter.java:27)
|     at org.testcontainers.utility.RyukResourceReaper.lambda$maybeStart$1 (RyukResourceReaper.java:88)
|     at java.lang.Thread.run (Thread.java:833)
| [ERROR] Timed out waiting for Ryuk container to start. Ryuk's logs:
| 2023/04/28 13:09:26 Pinging Docker...
| 2023/04/28 13:09:26 Docker daemon is available!
| 2023/04/28 13:09:26 Starting on port 8080...
| 2023/04/28 13:09:26 Started!
| [WARNING] Can not connect to Ryuk at 172.17.0.1:18499
| java.net.ConnectException: Connection refused
|     at sun.nio.ch.Net.pollConnect (Native Method)
|     at sun.nio.ch.Net.pollConnectNow (Net.java:672)
|     at sun.nio.ch.NioSocketImpl.timedFinishConnect (NioSocketImpl.java:542)
|     at sun.nio.ch.NioSocketImpl.connect (NioSocketImpl.java:597)
|     at java.net.SocksSocketImpl.connect (SocksSocketImpl.java:327)
|     at java.net.Socket.connect (Socket.java:633)
|     at org.testcontainers.utility.RyukResourceReaper.lambda$null$0 (RyukResourceReaper.java:92)
|     at org.rnorth.ducttape.ratelimits.RateLimiter.doWhenReady (RateLimiter.java:27)
|     at org.testcontainers.utility.RyukResourceReaper.lambda$maybeStart$1 (RyukResourceReaper.java:88)
|     at java.lang.Thread.run (Thread.java:833)
| [ERROR] Timed out waiting for Ryuk container to start. Ryuk's logs:
| 2023/04/28 13:09:26 Pinging Docker...
| 2023/04/28 13:09:26 Docker daemon is available!
| 2023/04/28 13:09:26 Starting on port 8080...
| 2023/04/28 13:09:26 Started!

Command used:

act -s GITHUB_TOKEN=ghp_XXXXXXXXXXXXXXXX

Steps to reproduce:

$> git clone https://github.com/McPringle/alfons.git
$> cd alfons
$> act -s GITHUB_TOKEN=ghp_YOUR_TOKEN

Actual behavior: job failed
Expected behavior: job successful, like on GitHub

@cltec
Copy link

cltec commented Apr 16, 2024

Same here, action working on github but failing in act using the "medium" configuration

@tschuehly
Copy link

Same issue here.

@TNorden
Copy link

TNorden commented Sep 11, 2024

I struggled with this for a while and found a solution

act --env TESTCONTAINERS_HOST_OVERRIDE=`ipconfig getifaddr en0` -W .github/workflows/test.yml

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

5 participants