我有一个在 ECS 中运行的自托管 GitHub Actions,它一直在创造奇迹,直到我不得不处理服务发现。
以下是工作流文件
name: Checks before merging for core-service server
on:
push:
paths:
- 'tons/of/paths/**'
jobs:
build:
runs-on: [self-hosted, linux, x64, nomad]
#set a timeout just in case the tests hang
timeout-minutes: 5
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: test-db
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpassword
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.16
uses: actions/setup-node@v1
with:
node-version: 14.16
- name: Install dependencies
run: npm ci
working-directory: some-dependency/location
- name: Check if build is passing
run: npm run build
working-directory: more-dependency/more-places
- name: Run tests
run: npm run test
env:
DATABASE_URL: mysql://user:password@127.0.0.1:${{ job.services.mysql.ports[3306] }}/test-db
working-directory: core-service/server
以下是我得到的错误
Using existing mysql database from: DATABASE_URL
Error: connect ECONNREFUSED 127.0.0.1:32777
任何意见将不胜感激。有美好的一天~