hashicorp/nomad-pack

Run jobs via ssh tunnel

AAverin opened this issue · 1 comments

I am using https://github.com/hashicorp/setup-nomad-pack to setup nomad-pack on github actions and make Nomad server from my private cluster available via ssh-tunnel on http://localhost:4646.
Running curl -Is http://127.0.0.1:4646 | head -1 on such instance gives HTTP/1.1 307 Temporary Redirect

The tunnel is configured via
ssh -4 -f -N -g -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i ./ssh_key -L 4646:BASTION_IP:4646 root@BASTION_IP

Executing jobs with this configuration results in an error:

! Failed To Parse Job Specification
!   Error: The variable scheme in the server URL has invalid value . Must be [https http]

The error is quite misleading and is likely related to NOMAD_ADDR being 127.0.0.1 or some other issue connected with ssh tuneling.

How can this issue be resolved?

What would be the right way to plan jobs on a remote cluster via github acitons?

So the right way to do it is to set NOMAD_ADDR=http://127.0.0.1:4646, not just NOMAD_ADDR=127.0.0.1
Because of _ADDR, I expected IP Address, but not URL.
Maybe this can be highlighted in the docs and examples better.
Error message can also be improved to be more clear what is the problem.