I'm trying to have google datastore emulator run as part of the CI. I've added a services section to .gitlab-ci.yml but there's an error.
Here's the full configuration YAML:
image: python:3.9-slim
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
variables:
DATASTORE_DATASET: project-007
DATASTORE_EMULATOR_HOST: google-cloud-sdk:8081
DATASTORE_EMULATOR_HOST_PATH: google-cloud-sdk:8081/datastore
DATASTORE_HOST: http://google-cloud-sdk:8081
DATASTORE_PROJECT_ID: project-007
before_script:
- apt-get update && apt-get install -y ffmpeg make
- python --version # Print out python version for debugging
- cd backend
- python -m pip install -r dev-requirements.txt
test:
services:
- name: google/cloud-sdk:latest
command: ["gcloud", "beta", "emulators", "datastore", "start", "--host-port", "0.0.0.0:8080"]
variables:
CLOUDSDK_CORE_PROJECT: project-007
script:
- make test
The error I see in the CI logs is:
*** WARNING: Service runner--azerasq-project-26594908-concurrent-0-aababf5d82e87691-google__cloud-sdk-0 probably didn't start properly.
Health check error:
service "runner--azerasq-project-26594908-concurrent-0-aababf5d82e87691-google__cloud-sdk-0-wait-for-service" health check: exit code 1
Health check container logs:
2021-11-25T15:49:31.057994970Z FATAL: No HOST or PORT found
Service container logs:
2021-11-25T15:49:30.783697828Z Executing: /usr/lib/google-cloud-sdk/platform/cloud-datastore-emulator/cloud_datastore_emulator create --project_id=gitlab-ci-plan-free-5-6ef84d /root/.config/gcloud/emulators/datastore
*********
Any ideas how to fix this or a better way to run the datastore emulator in the gitlab CI? Thanks!