#Running in CI: 502 Bad Gateway: http do: Post "http://dagger/query"

1 messages · Page 1 of 1 (latest)

stark prairie
#

Hi,
I'm trying to build my pipelines around Dagger. The CI engine is BitBucket Pipelines. For some reason, I'm getting this weird error during build or one of our component builds:

26: [16.1s] Starting a Gradle Daemon (subsequent builds will be faster)
26: [97.3s] > Task :gradle-plugin:pluginDescriptors
26: [97.3s] > Task :gradle-plugin:processResources
unexpected EOF
panic: returned error 502 Bad Gateway: http do: Post "http://dagger/query": rpc error: code = Unavailable desc = error reading from server: command [docker exec -i dagger-engine-e2fe78671e5bc285 buildctl dial-stdio] has exited with exit status 255, please make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=
goroutine 1 [running]:
main/task.BuildAndroid()
    /opt/atlassian/pipelines/agent/build/tools/dagger-go/task/buildAndroid.go:40 +0xe14
main.init.func3()
    /opt/atlassian/pipelines/agent/build/tools/dagger-go/ci.go:15 +0xf
main.main()
    /opt/atlassian/pipelines/agent/build/tools/dagger-go/ci.go:39 +0x30d
exit status 2
26: ...

It's react-native build for android. For some reason I can't replicate it locally.

Where/why does dagger make requests to http://dagger/* ? Where does this hostname/domain name even come from? Any hints about the /query URL?
If I docker-exec into a dagger-engine contianer running locally I can't reolve 'dagger' either. Why would the CI even consider there's such a domain name?

And no, I have not specified 'dagger' as a hostname anywhere.

#

this is the core of the task I'm running:

    exported, err := client.Container().From("reactnativecommunity/react-native-android:latest").
        WithDirectory("/src", client.Host().Directory(".")).
        WithWorkdir("/src").
        WithMountedCache("/src/node_modules", nodeDepCache).
        WithMountedCache("/root/.m2", mavenDepCache).
        WithExec(c.Split("npm install")).
        WithExec([]string{"sh", "-xc", "npm run build:android 2>&1 | grep -C1000 'Bad Gateway'"}).
        Directory("/src/android/app/build/outputs").Export(ctx, "./android/app/build/outputs")

And it's curious that grep does not really capture anything (gradle debug loglevel is enabled, so if it did, there should be much more lines in the output (grep -C 1000)). It almost feels like the error is printed not by anything launched by npm, but something else holding a reference to the same pty. Like dagger (dagger run <...>)

#

a-HA! Stracing the dagger run <... locally revealed that dagger is indeed sending HTTP POST requests to http://dagger/query

[pid 3388706] <... read resumed>"\0\1>\0\0\0\0\0\t\0\0\0\19\n\266\2POST /query HTTP/1.1\r\nHost: dagger\r\nUser-Agent: Go-http-client/1.1\r\nContent-L<...>

At first I had doubts whether it's the build container or npm or smth under my control making those requests. Now I'm confident it isn't - it's the dagger binary