1

I'm trying to get my Continuous Delivery working and subsequently uploading binaries to a company server, which is only accessible through VPN connection.

The problem is, every single time I try it, I'm getting the following error:

Connected as 158.196.194.120 + 2001:718:1001:111::7/64, using SSL
DTLS handshake timed out
DTLS handshake failed: Resource temporarily unavailable, try again.
Failed to bind local tun device (TUNSETIFF): Operation not permitted
To configure local networking, openconnect must be running as root
See http://www.infradead.org/openconnect/nonroot.html for more information
Set up tun device failed
Unknown error; exiting.

The strange thing is, that my code uses sudo explicitly in .gitlab-ci.yml, so I'd expect it to have all the rights.

deploy_spline:
    stage: deploy
    image: martinbeseda/lib4neuro-ubuntu-system-deps:latest
    dependencies:
        - test_spline
    before_script:
        - echo "DEPLOY!"
        - apt-get -y install lftp openconnect sudo
    script:
        - mkfifo mypipe
        - export USER=${USER}
        - echo "openconnect -v --authgroup VSB -u ${USER} --passwd-on-stdin vpn.vsb.cz < mypipe &" > vpn.sh
        - chmod +x vpn.sh
        - sudo ./vpn.sh
        - echo "${PASS}">mypipe
        - lftp -u ${USER},${PASS} sftp://moldyn.vsb.cz:/moldyn.vsb.cz/www/releases -e "put build/SSR1D_spline.out; exit"

So, do you know, what's wrong with my code? Or is it some GitLab CD specific problem?

Eenoku
  • 2,741
  • 4
  • 32
  • 64

1 Answers1

2

The Gitlab CI runner needs to run in privileged mode to bind the tunnel interface. Check your /etc/gitlab-runner/config.toml file and make sure that your runner has privileged set to true.

[[runners]]
  name = "privileged runner"
  ...
  [runners.docker]
    privileged = true

Without that setting, the build container doesn't have the ability to bind the interface, even as root.

David Dean
  • 51
  • 4