Drone

Aliases/hostnames

Hi! I just started using Drone and so far I love what I see. I have a problem though: I am building an image, and to run tests with it I am using some services including selenium for acceptance tests. Tests require some specific hostnames for some things, so with docker compose I can specify the network aliases. How can I specify aliases/hostnames for the container I just built, so that selenium can connect to it using those hostnames?

Thanks!

the hostname is the name of the step, so you can name the step to match the desired hostname.

Hi! Not sure I am following. The step where I would need the additional hostnames looks something like this:

I would need the app to be reachable by the selenium service at some specific hostnames. Thanks

The step name is the hostname.

Example service and hostname:

kind: pipeline
type: docker
name: default

steps:
- name: ping
  image: redis
  commands:
  - sleep 5
  - redis-cli -h cache.drone.io ping

services:
- name: cache.drone.io
  image: redis

Example service defined in the pipeline section with hostname:

kind: pipeline
type: docker
name: default

steps:
- name: cache.drone.io
  image: redis
  detach: true

- name: ping
  image: redis
  commands:
  - sleep 5
  - redis-cli -h cache.drone.io ping

further reading at https://docker-runner.docs.drone.io/configuration/services/

Oh I see. The problem is that I have some tests that expect one hostname and some other tests that expect another hostname. If I create two steps each with one hostname as the name of the step, I would have to run all the tests twice and anyway the first time the tests expecting the other hostname would fail because that hostname is not reachable by the selenium container. Any workaround?

sorry, the docker runner [1] only supports a single hostname for each step. you could use the exec runner [2] which does not use docker, and then you could use your own docker-compose file for testing.

[1] https://docker-runner.docs.drone.io/
[2] https://exec-runner.docs.drone.io/

I have Drone running in Kubernetes. Sounds like it’s something I can’t do?