Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
b8b18dbe
Commit
b8b18dbe
authored
8 years ago
by
Alex Dadgar
Browse files
Options
Download
Email Patches
Plain Diff
Structs
parent
53eb407c
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/jobs.go
+15
-0
api/jobs.go
nomad/job_endpoint.go
+3
-2
nomad/job_endpoint.go
nomad/structs/structs.go
+24
-9
nomad/structs/structs.go
with
42 additions
and
11 deletions
+42
-11
api/jobs.go
+
15
-
0
View file @
b8b18dbe
...
...
@@ -539,6 +539,21 @@ type JobValidateResponse struct {
Error
string
}
// JobRevertRequest is used to revert a job to a prior version.
type
JobRevertRequest
struct
{
// JobID is the ID of the job being reverted
JobID
string
// JobVersion the version to revert to.
JobVersion
uint64
// EnforcePriorVersion if set will enforce that the job is at the given
// version before reverting.
EnforcePriorVersion
*
uint64
WriteRequest
}
// JobUpdateRequest is used to update a job
type
JobRegisterRequest
struct
{
Job
*
Job
...
...
This diff is collapsed.
Click to expand it.
nomad/job_endpoint.go
+
3
-
2
View file @
b8b18dbe
...
...
@@ -286,8 +286,8 @@ func (j *Job) Summary(args *structs.JobSummaryRequest,
}
// Validate validates a job
func
(
j
*
Job
)
Validate
(
args
*
structs
.
JobValidateRequest
,
reply
*
structs
.
JobValidateResponse
)
error
{
func
(
j
*
Job
)
Validate
(
args
*
structs
.
JobValidateRequest
,
reply
*
structs
.
JobValidateResponse
)
error
{
defer
metrics
.
MeasureSince
([]
string
{
"nomad"
,
"job"
,
"validate"
},
time
.
Now
())
if
err
:=
validateJob
(
args
.
Job
);
err
!=
nil
{
if
merr
,
ok
:=
err
.
(
*
multierror
.
Error
);
ok
{
...
...
@@ -300,6 +300,7 @@ func (j *Job) Validate(args *structs.JobValidateRequest,
reply
.
Error
=
err
.
Error
()
}
}
reply
.
DriverConfigValidated
=
true
return
nil
}
...
...
This diff is collapsed.
Click to expand it.
nomad/structs/structs.go
+
24
-
9
View file @
b8b18dbe
...
...
@@ -294,17 +294,19 @@ type JobValidateRequest struct {
WriteRequest
}
// JobValidateResponse is the response from validate request
type
JobValidateResponse
struct
{
// DriverConfigValidated indicates whether the agent validated the driver
// config
DriverConfigValidated
bool
// JobRevertRequest is used to revert a job to a prior version.
type
JobRevertRequest
struct
{
// JobID is the ID of the job being reverted
JobID
string
//
ValidationErrors is a list of validation errors
ValidationErrors
[]
string
//
JobVersion the version to revert to.
JobVersion
uint64
// Error is a string version of any error that may have occured
Error
string
// EnforcePriorVersion if set will enforce that the job is at the given
// version before reverting.
EnforcePriorVersion
*
uint64
WriteRequest
}
// NodeListRequest is used to parameterize a list request
...
...
@@ -493,6 +495,19 @@ type JobDeregisterResponse struct {
QueryMeta
}
// JobValidateResponse is the response from validate request
type
JobValidateResponse
struct
{
// DriverConfigValidated indicates whether the agent validated the driver
// config
DriverConfigValidated
bool
// ValidationErrors is a list of validation errors
ValidationErrors
[]
string
// Error is a string version of any error that may have occured
Error
string
}
// NodeUpdateResponse is used to respond to a node update
type
NodeUpdateResponse
struct
{
HeartbeatTTL
time
.
Duration
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help