Cannot use Keycloak as CI/CD service correctly

Problem Statement

I am trying to setup a CI/CD pipeline that requires a running instance of Keycloak to be available. It seems to me that the ideal way to achieve this is by using services to start Keycloak from a Docker image that the pipeline will then make requests to. However, while the Keycloak service seems to start, I am having some issues connecting to it.

Here's a minimal configuration that reproduces the problem (you can find the project here):

check:
    image: curlimages/curl
    services:
        - name: jboss/keycloak:11.0.0
          alias: keycloak
    script:
      - curl http://keycloak:8080
      - curl http://keycloak:8080/auth/

Whereas the first curl command succeeds with a status code of 200, the second one returns a 404 page. If I simply run the same image locally, both commands succeed as expected.

Any idea what I might be doing wrong?

Reach

I have no idea how often people need this, but I found at least one other person with the same issue: https://stackoverflow.com/questions/61893539/using-keycloak-as-gitlab-ci-service

Impact

Fixing this would have a massive impact for me, since my pipeline depends on this to run.

Confidence

I have moderate confidence this is a problem. It might be that I'm missing something in my configuration.

Effort

No clue.

Edited Oct 30, 2020 by José Pedro Correia
Assignee Loading
Time tracking Loading