Following this article and using this help document, I am trying to get RabbitMQ started as a service for my job. The container starts, but the environment variable interpolation does not appear to be working.
Here is my workflow:
name: Test & Publish
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
services:
rabbitmq:
image: rabbitmq
ports:
- 5672/tcp
env:
RABBITMQ_USER: guest
RABBITMQ_PASSWORD: guest
RABBITMQ_VHOST: "/"
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
- run: yarn
- run: ./scripts/test-all.sh
env:
RABBITMQ_HOST: rabbitmq
RABBITMQ_PORT: $❴❴ job.services.rabbitmq.ports['5672'] ❵❵
publish-npm:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: yarn
- run: yarn semantic-release
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
The issue is RABBITMQ_PORT
part. I modified my code to print out the value of
console.log(`amqp://${process.env.RABBITMQ_HOST}:${process.env.RABBITMQ_PORT}`)
... and I get this in the logs:
amqp://rabbitmq:$❴❴ job.services.rabbitmq.ports['5672'] ❵❵
... which is wrong. The RabbitMQ container seems to have started successfully, and I see it mapped the port: 5672/tcp -> 0.0.0.0:32768
, so if the interpolation were correct, I would expect to see
amqp://rabbitmq:32768
Yet the docs don't appear to be doing the interpolation any differently than I am doing, so I'm confused as to what the issue is.
My problem was copy/paste.
I pasted in
when it should've been
The curly braces are a different character code: