I am trying to connect to a RabbitMQ service in my CI/CD pipeline, but I am getting errors trying to connect to the service.
Given this configuration:
testing:
stage: test
tags:
- arm64
needs:
- "build_linux_arm64"
variables:
FF_NETWORK_PER_BUILD: 1
services:
- name: rabbitmq:3.9-alpine
variables:
RABBITMQ_DEFAULT_USER: rabbit
RABBITMQ_DEFAULT_PASSWORD: rabbit
RABBITMQ_DEFAULT_VHOST: "/"
image: mcr.microsoft.com/dotnet/sdk:6.0
script:
- dotnet test -p:"WarningLevel=0" --test-adapter-path:. --logger:"junit;LogFilePath=..\artifacts\{assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose"
artifacts:
when: always
paths:
- "./**/*test-result.xml"
reports:
junit:
- "./**/*test-result.xml"
And this is the connection string: amqp://rabbit:rabbit@rabbitmq-3.9-alpine:5762
,
When I trigger the pipeline with a commit,
Then this is the result:
RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable
---> System.AggregateException: One or more errors occurred. (Connection failed)
---> RabbitMQ.Client.Exceptions.ConnectFailureException: Connection failed
---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): Name or service not known
at System.Net.Dns.GetHostEntryOrAddressesCore(String hostName, Boolean justAddresses, AddressFamily addressFamily, ValueStopwatch stopwatch)
at System.Net.Dns.<>c.<GetHostEntryOrAddressesCoreAsync>b__33_0(Object s, ValueStopwatch stopwatch)
at System.Net.Dns.<>c__DisplayClass39_0`1.<RunAsync>b__0(Task <p0>, Object <p1>)
at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location