Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change_mode="script" not working with techpreview2 #323

Open
flz opened this issue Apr 23, 2023 · 0 comments
Open

change_mode="script" not working with techpreview2 #323

flz opened this issue Apr 23, 2023 · 0 comments

Comments

@flz
Copy link

flz commented Apr 23, 2023

Here's the test repro:

$ cat foo.nomad.tpl
job "foo" {
  datacenters = ["xxx"]
  group "foo" {
    task "foo" {
      driver = "docker"
      config {
        image = "alpine"
      }

      template {
        data = "foo"
        destination = "local/foo.txt"
        change_mode = "script"
        change_script {
          command = "/bin/true"
        }
      }
    }
  }
}

As shown below, nomad-pack plan fails but nomad-pack render + nomad plan seems to work just fine.

$ nomad-pack plan ../../packs/foo
! Failed To Perform Plan

        Error:   1 error occurred:
        * Task group foo validation failed: 1 error occurred:
        * Task foo validation failed: 1 error occurred:
        * Template 1 validation failed: 1 error occurred:
        * must specify change script configuration value when change mode is script

        Type:    *errors.errorString
        Context: 
                 - Registry Name: dev
                 - Pack Name: foo
                 - Pack Ref: dev
                 - Deployment Name: foo
                 - Template Name: foo/templates/foo.nomad.tpl
                 - Job Name: foo

$ nomad-pack render ../../packs/foo -o .
foo/foo.nomad:

job "foo" {
  datacenters = ["xxx"]
  group "foo" {
    task "foo" {
      driver = "docker"
      config {
        image = "alpine"
      }

      template {
        data = "foo"
        destination = "local/foo.txt"
        change_mode = "script"
        change_script {
          command = "/bin/true"
        }
      }
    }
  }
}

$ nomad plan ./foo/foo.nomad
+ Job: "foo"
+ Task Group: "foo" (1 create)
  + Task: "foo" (forces create)

Scheduler dry-run:
- All tasks successfully allocated.

Job Modify Index: 0
To submit the job with version verification run:

nomad job run -check-index 0 ./foo/foo.nomad

When running the job with the check-index flag, the job will only be run if the
job modify index given matches the server-side version. If the index has
changed, another user has modified the job and the plan's results are
potentially invalid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant