我目前正在使用无服务器框架,并使用共享的Runner设置GitLab CI。
以下是我的gitlab-ci.yml文件:
image: node:latest
services:
- redis
cache:
paths:
- node_modules/
- java/
stages:
- build
- test
- review
- staging
- production
build:
stage: build
script:
- npm install
artifacts:
paths:
- node_modules/
install:java:
stage: build
script:
- apt-get update
- apt-get install -y default-jre default-jdk openjdk-7-jre openjdk-7-jdk
- apt-get update
- sls dynamodb install
artifacts:
paths:
- java/
connect:
image: redis
script:
- redis-cli -h redis PING
unit test:
stage: test
script:
- sls dynamodb start
- babel-node ./aws/createDB.js
- npm run unit
dependencies:
- build
- install:java
单元测试工作需要 Redis,但无法连接。当单元测试工作启动时,会抛出以下错误:
创建 Redis 客户端时发生错误:错误:Redis 连接到 127.0.0.1:6379 失败 - 连接 ECONNREFUSED 127.0.0.1:6379
有人可以指出当前配置文件有什么问题吗?谢谢!