How to start a Linux service in a Windows job?

I am trying to run tests on a Windows runner where my application is installed. I also need a postgres database. Since there are no official postgres images for Windows Container I am out of luck. I tried to build one myself but so far it does not work.

I was wondering if there is any way to run the job image on Windows while a service of a job runs on Linux. Is that possible?

test windows:
  stage: test
  image: internal.registry/win-test-image:1
  tags:
    # make sure this job only starts on runners with Windows
    - windows
  script:
    - ./gradlew test --no-daemon
  artifacts:
    when: on_success
    expire_in: "1 days"
    paths:
      - logs
    reports:
      junit: build\\test-results\\test\\TEST-*.xml

But when I add:

  variables:
    POSTGRES_DB: pgsql
    POSTGRES_USER: pgsql
    POSTGRES_PASSWORD: password
    POSTGRES_HOST_AUTH_METHOD: trust
  services:
    - postgres:15.4-alpine

it fails. My guess is, that such a combination is not possible.

1 Like

Your guess is correct.

1 Like