Drone

Help with Selenium Grid on 0.8

With 0.5 I had the following setup to run grid with one FF node… this worked fine using grid url http://127.0.0.1:4444/wd/hub

  selenium-grid-hub:
    image: selenium/hub:3.7.1
    ports:
      - "4444:4444"
    environment:
      - GRID_TIMEOUT=180000
      - GRID_BROWSER_TIMEOUT=180000

  selenium-node-firefox:
    image: selenium/node-firefox:3.7.1
    environment:
      SE_OPTS: "-port 4445"
      HUB_PORT_4444_TCP_ADDR: 127.0.0.1
      HUB_PORT_4444_TCP_PORT: 4444
      DISPLAY: ":98.0"

For 0.8 with the changes in services hostname approach, I changed it to following but it isn’t working now. The issue seems like node is not able to register to hub using a hostname, so I’m getting error like “Couldn’t register this node: Error sending the registration request: selenium-grid-hub”.
Also, the pipeline containers aren’t able to resolve services hostnames, so following isn’t working either…
http://selenium-grid-hub:4444/wd/hub

I noticed it worked once, so could this be a timing issue. I tried depends_on, sleep options with services container but no use.

  selenium-grid-hub:
    image: selenium/hub:3.7.1
    ports:
      - "4444:4444"
    environment:
      - GRID_TIMEOUT=180000
      - GRID_BROWSER_TIMEOUT=180000

  selenium-node-firefox:
    image: selenium/node-firefox:3.7.1
    environment:
      SE_OPTS: "-port 4445"
      HUB_PORT_4444_TCP_ADDR: selenium-grid-hub
      HUB_PORT_4444_TCP_PORT: "4444"
      DISPLAY: ":98.0"

EDIT: I logged into the node container and checked if selenium-grid-hub resolves. It does sometimes but most of the times its not. So is there a way I can wait until the services hostnames are set or include dependency between services? Clearly, docker’s depends_on doesn’t work here and neither sleep as drone tries to bring up all services concurrently I guess.

The Selenium grid example was ported to 0.8 and was successfully tested:

I noticed it worked once, so could this be a timing issue. I tried depends_on, sleep options with services container but no use.

I doubt that is the issue.

If you look at the logs from our sample project, you will notice the selenium node will backoff and attempt to reconnect. This likely happens because the selenium grid is not yet available. The node handles this situation, which means a sleep or depends_on would not be required.

07:46:44.272 INFO - Couldn't register this node: Error sending the registration request: selenium
07:46:49.278 INFO - Couldn't register this node: The hub is down or not responding: selenium
07:46:54.309 INFO - Registering the node to the hub: http://selenium:4444/grid/register
07:46:54.345 INFO - The node is registered to the hub and ready to use

Thanks for the response and the example project. I ran your setup “as is” on Docker CE 17.07 it failed but passed on Docker CE 18.02. Same results with my setup as well, so I’m thinking its something to do with Docker version.
Sorry, haven’t investigated further.

I executed the tests with 17.x although I’m not sure the exact version

Hello - getting this same issue using with selenium grid using the same format (updated from 0.8) from https://github.com/drone-demos/drone-go-selenium/blob/chrome-and-firefox/.drone.yml

kind: pipeline
name: default
steps:
  - name: test
    image: 'my-image'
    pull: if-not-exists
    commands:
      - yarn run test
  - name: slack
    image: plugins/slack
    settings:
      webhook:
        from_secret: slack_webhook
    when:
      status: [ failure ]

services:
  - name: selenium
      image: selenium/hub

  - name: chrome
      image: selenium/node-chrome
      environment:
        HUB_PORT_4444_TCP_ADDR: selenium
        HUB_PORT_4444_TCP_PORT: "4444"
        DISPLAY: ":99.0"

  - name: firefox
      image: selenium/node-firefox
      environment:
        HUB_PORT_4444_TCP_ADDR: selenium
        HUB_PORT_4444_TCP_PORT: "4444"
        DISPLAY: ":98.0"

the error I get is:

22:51:59.002 INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: The hub is down or not responding: selenium
22 22:52:04.011 INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: The hub is down or not responding: selenium: Name or service not known

The build hangs with this repeated error