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

build: update Nomad dependency to 1.9.0 #581

Merged
merged 6 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
## UNRELEASED

BREAKING CHANGES:
* template: HCL1 parsing has been removed and is no longer available [[GH-581](https://github.com/hashicorp/nomad-pack/pull/581)]

IMPROVEMENTS:
* build: Update Go version to 1.23.2 [[GH-580](https://github.com/hashicorp/nomad-pack/pull/580)]
* deps: Update Nomad version to 1.9.0 [[GH-581](https://github.com/hashicorp/nomad-pack/pull/581)]

BUG FIXES:
* cli: Update references to `hello-world` pack in command help text to `hello_world` [[GH-523](https://github.com/hashicorp/nomad-pack/pull/523)]
Expand Down
155 changes: 86 additions & 69 deletions go.mod

Large diffs are not rendered by default.

383 changes: 204 additions & 179 deletions go.sum

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions internal/cli/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func renderVariableOverrideFile(
// between layers.
// Uses open api client to parse rendered hcl templates to
// open api jobs to send to nomad
func parseJob(cmd *baseCommand, hcl string, hclV1 bool, errCtx *errors.UIErrorContext) (*api.Job, error) {
func parseJob(cmd *baseCommand, hcl string, errCtx *errors.UIErrorContext) (*api.Job, error) {
// instantiate client to parse hcl
c, err := cmd.getAPIClient()
if err != nil {
Expand All @@ -202,7 +202,6 @@ func parseJob(cmd *baseCommand, hcl string, hclV1 bool, errCtx *errors.UIErrorCo

parsedJob, err := c.Jobs().ParseHCLOpts(&api.JobsParseRequest{
JobHCL: hcl,
HCLv1: hclV1,
Canonicalize: true,
})
if err != nil {
Expand Down
7 changes: 0 additions & 7 deletions internal/cli/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,6 @@ func (c *PlanCommand) Flags() *flag.Sets {
Sentinel policies.`,
})

f.BoolVar(&flag.BoolVar{
Name: "hcl1",
Target: &c.jobConfig.PlanConfig.HCL1,
Default: false,
Usage: `If set, HCL1 parser is used for parsing the job spec.`,
})

f.BoolVarP(&flag.BoolVarP{
BoolVar: &flag.BoolVar{
Name: "verbose",
Expand Down
8 changes: 0 additions & 8 deletions internal/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,6 @@ func (c *RunCommand) Flags() *flag.Sets {
when updating a job.`,
})

f.BoolVar(&flag.BoolVar{
Name: "hcl1",
Target: &c.jobConfig.RunConfig.HCL1,
Default: false,
Usage: `If set, the hcl V1 parser will be used to parse the job
file.`,
})

f.BoolVar(&flag.BoolVar{
Name: "rollback",
Hidden: true,
Expand Down
3 changes: 1 addition & 2 deletions internal/cli/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ func (c *StopCommand) Run(args []string) int {
tplErrorContext.Add(errors.UIContextPrefixTemplateName, tplName)

// get job struct from template
// TODO: Should we add an hcl1 flag?
var job *api.Job
job, err = parseJob(c.baseCommand, tpl, false, tplErrorContext)
job, err = parseJob(c.baseCommand, tpl, tplErrorContext)
if err != nil {
// err output is handled by parseJob
return 1
Expand Down
1 change: 0 additions & 1 deletion internal/cli/testhelper/testhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ func NomadRun(s *agent.TestAgent, path string) error {
// Parse into JSON Jobspec
j, err := c.Jobs().ParseHCLOpts(&api.JobsParseRequest{
JobHCL: string(jB),
HCLv1: false,
Canonicalize: true,
})
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions internal/runner/job/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ type RunCLIConfig struct {
VaultToken string
VaultNamespace string
EnableRollback bool
HCL1 bool
PreserveCounts bool
PolicyOverride bool
}

// PlanCLIConfig specifies the configuration that is used by the Nomad Pack
// plan command.
type PlanCLIConfig struct {
HCL1 bool
PolicyOverride bool
Verbose bool
Diff bool
Expand Down
11 changes: 1 addition & 10 deletions internal/runner/job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,10 @@ func (r *Runner) Deploy(ui terminal.UI, errorContext *errors.UIErrorContext) *er
tplErrorContext := errorContext.Copy()
tplErrorContext.Add(errors.UIContextPrefixTemplateName, tplName)

templateFormat := func() string {
if r.cfg.RunConfig.HCL1 {
return "hcl1"
}
return "hcl2"
}()

// submit the source of the job to Nomad, too
submission := &api.JobSubmission{
Source: r.rawTemplates[tplName],
Format: templateFormat,
Format: "hcl2",
}

registerOpts := api.RegisterOptions{
Expand Down Expand Up @@ -260,7 +253,6 @@ func (r *Runner) ParseTemplates() []*errors.WrappedUIContext {

ncJob, err := r.client.Jobs().ParseHCLOpts(&api.JobsParseRequest{
JobHCL: tpl,
HCLv1: r.cfg.RunConfig.HCL1,
Canonicalize: false,
})
if err != nil {
Expand All @@ -273,7 +265,6 @@ func (r *Runner) ParseTemplates() []*errors.WrappedUIContext {

job, err := r.client.Jobs().ParseHCLOpts(&api.JobsParseRequest{
JobHCL: tpl,
HCLv1: r.cfg.RunConfig.HCL1,
Canonicalize: true,
})
if err != nil {
Expand Down