Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

error parsing job file #400

@tcurdt

Description

@tcurdt

Description

For now I am trying to use levant with a static job hcl file.
While it works perfectly fine to run that job through nomad directly, levant fails parsing it.

Relevant Nomad job specification file

$ cat job.hcl 
variables {
  domain = "dev.foo.com"
  database = "foo"
  version = "staging"
}

job "backend-staging" {

  datacenters = [ "foo" ]

  group "backend" {

    count = 1

    network {
      port  "nodejs" {
        host_network = "private"
      }
    }

    service {
      name = "backend-staging"
      port = "nodejs"
      tags = [
        "traefik.enable=true",
        "traefik.http.routers.backend.tls=true",
        "traefik.http.routers.backend.tls.certresolver=le",
        "traefik.http.routers.backend.entrypoints=websecure",
        "traefik.http.services.backend.loadbalancer.server.port=${NOMAD_PORT_nodejs}",
        "traefik.http.routers.backend.rule=Host(`${var.domain}`) && PathPrefix(`/api`)",
      ]
    }

    task "nodejs" {
      driver = "docker"

      env = {
        NODE_ENV = "production"
        NODE_ADDRESS = "${NOMAD_IP_nodejs}"
        NODE_PORT = "${NOMAD_PORT_nodejs}"
        MONGODB_URI = "mongodb://127.0.0.1:27017"
        MONGODB_DB_NAME = var.database
      }

      config {
        image = "registry.gitlab.com/foo/backend:${var.version}"
        network_mode = "host"
        ports = [ "nodejs" ]
      }
    }
  }

}

Output of levant version:

$ ./levant version
Levant v0.2.9
Date: 2019-12-27T09:43:30Z
Commit: 0f1913ea3d77584ddd0696da429dcf05572a73a0
Branch: 0.2.9
State: 0.2.9
Summary: 0f1913ea3d77584ddd0696da429dcf05572a73a0

Output of consul version:

$ consul version
Consul v1.9.4
Revision 10bb6cb3b

Output of nomad version:

$ nomad version
Nomad v1.0.4 (9294f35f9aa8dbb4acb6e85fa88e3e2534a3e41a)

Debug log outputs from Levant:

$ ./levant plan job.hcl 
[ERROR] levant/command: error parsing: At 45:27: Unknown token: 45:27 IDENT var.database

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions