Skip to content

Commit

Permalink
DEVPROD-2731 Update task.status field to reflect a tasks original sta…
Browse files Browse the repository at this point in the history
…tus (#8585)
  • Loading branch information
khelif96 authored Jan 8, 2025
1 parent aa4b520 commit 6a866c5
Show file tree
Hide file tree
Showing 29 changed files with 110 additions and 129 deletions.
2 changes: 0 additions & 2 deletions gqlgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,6 @@ models:
resolver: true
spawnHostLink:
resolver: true
status:
resolver: true
isPerfPluginEnabled:
resolver: true
project:
Expand Down
49 changes: 8 additions & 41 deletions graphql/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions graphql/schema/types/task.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ type Task {
activatedTime: Time
ami: String
annotation: Annotation
"""
This is a base task's display status.
"""
baseStatus: String
baseTask: Task
blocked: Boolean!
Expand All @@ -73,6 +76,9 @@ type Task {
details: TaskEndDetail
dispatchTime: Time
displayName: String!
"""
This is a task's display status and is what is commonly used on the UI.
"""
displayStatus: String!
displayOnly: Boolean
displayTask: Task
Expand Down Expand Up @@ -111,10 +117,9 @@ type Task {
spawnHostLink: String
startTime: Time
"""
This is a task's display status and is what is commonly used on the UI.
In future releases this will be migrated to represent the original status of the task
This is a task's original status. It is the status stored in the database, and is distinct from the displayStatus.
"""
status: String! @deprecated(reason: "use displayStatus instead. Status will be migrated to reflect the original status")
status: String!
tags: [String!]!
taskGroup: String
taskGroupMaxHosts: Int
Expand Down
5 changes: 0 additions & 5 deletions graphql/task_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,6 @@ func (r *taskResolver) SpawnHostLink(ctx context.Context, obj *restModel.APITask
return nil, nil
}

// Status is the resolver for the status field.
func (r *taskResolver) Status(ctx context.Context, obj *restModel.APITask) (string, error) {
return *obj.DisplayStatus, nil
}

// TaskLogs is the resolver for the taskLogs field.
func (r *taskResolver) TaskLogs(ctx context.Context, obj *restModel.APITask) (*TaskLogs, error) {
canView := hasLogViewPermission(ctx, obj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mutation{
overrideTaskDependencies(taskId: "no_permissions"){
id
execution
status
displayStatus
dependsOn {
name
metStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mutation{
overrideTaskDependencies(taskId: "t1"){
id
execution
status
displayStatus
dependsOn {
name
metStatus
Expand Down
7 changes: 5 additions & 2 deletions graphql/tests/mutation/overrideTaskDependencies/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"overrideTaskDependencies": {
"id": "t1",
"execution": 0,
"status": "will-run",
"displayStatus": "will-run",
"dependsOn": [
{
"name": "a dep",
Expand All @@ -27,7 +27,10 @@
"errors": [
{
"message": "user 'regular_user' does not have permission to 'edit tasks' for the project 'evergreen'",
"path": ["overrideTaskDependencies", "taskId"],
"path": [
"overrideTaskDependencies",
"taskId"
],
"extensions": {
"code": "FORBIDDEN"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mutation {
restartTask(taskId: "nonexistent", failedOnly: false) {
status
displayStatus
id
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mutation {
restartTask(taskId: "no_permissions", failedOnly: false) {
status
displayStatus
id
}
}
2 changes: 1 addition & 1 deletion graphql/tests/mutation/restartTask/queries/success.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mutation {
restartTask(taskId: "task1", failedOnly: false) {
status
displayStatus
id
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
mutation {
restartTask(taskId: "task3", failedOnly: true) {
id
status
displayStatus
executionTasksFull {
id
status
displayStatus
}
}
}
27 changes: 20 additions & 7 deletions graphql/tests/mutation/restartTask/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
{
"query_file": "success.graphql",
"result": {
"data": { "restartTask": { "status": "will-run", "id": "task1" } }
"data": {
"restartTask": {
"displayStatus": "will-run",
"id": "task1"
}
}
}
},
{
Expand All @@ -12,8 +17,13 @@
"errors": [
{
"message": "finding project for task 'nonexistent': task not found",
"path": ["restartTask", "taskId"],
"extensions": { "code": "RESOURCE_NOT_FOUND" }
"path": [
"restartTask",
"taskId"
],
"extensions": {
"code": "RESOURCE_NOT_FOUND"
}
}
],
"data": null
Expand All @@ -25,15 +35,15 @@
"data": {
"restartTask": {
"id": "task3",
"status": "will-run",
"displayStatus": "will-run",
"executionTasksFull": [
{
"id": "execution_task_1",
"status": "will-run"
"displayStatus": "will-run"
},
{
"id": "execution_task_2",
"status": "success"
"displayStatus": "success"
}
]
}
Expand All @@ -48,7 +58,10 @@
"errors": [
{
"message": "user 'regular_user' does not have permission to 'edit tasks' for the project 'evergreen'",
"path": ["restartTask", "taskId"],
"path": [
"restartTask",
"taskId"
],
"extensions": {
"code": "FORBIDDEN"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ mutation {
scheduleUndispatchedBaseTasks(versionId: "5e4ff3abe3c3317e352062e5") {
id
execution
status
displayStatus
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ mutation {
scheduleUndispatchedBaseTasks(versionId: "9e4ff3abe3c3317e352062e4") {
id
execution
status
displayStatus
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ mutation {
scheduleUndispatchedBaseTasks(versionId: "spruce_5e4ff3abe3c3317e352062e4") {
id
execution
status
displayStatus
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"id": "base-task-2",
"execution": 0,
"status": "will-run"
"displayStatus": "will-run"
}
]
}
Expand All @@ -22,12 +22,12 @@
{
"id": "base_generated_task",
"execution": 0,
"status": "will-run"
"displayStatus": "will-run"
},
{
"id": "base_generator_task",
"execution": 0,
"status": "will-run"
"displayStatus": "will-run"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion graphql/tests/task/annotation/queries/annotation.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ query {
taskId: "evergreen_ubuntu1604_test_db_patch_5e823e1f28baeaa22ae00823d83e03082cd148ab_5e4ff3abe3c3317e352062e4_20_02_21_15_13_48"
execution: 0
) {
status
displayStatus
annotation {
taskId
taskExecution
Expand Down
2 changes: 1 addition & 1 deletion graphql/tests/task/annotation/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"result": {
"data": {
"task": {
"status": "known-issue",
"displayStatus": "known-issue",
"annotation": {
"taskId": "evergreen_ubuntu1604_test_db_patch_5e823e1f28baeaa22ae00823d83e03082cd148ab_5e4ff3abe3c3317e352062e4_20_02_21_15_13_48",
"taskExecution": 0,
Expand Down
2 changes: 1 addition & 1 deletion graphql/tests/task/displayStatus/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"result": {
"data": {
"task": {
"status": "known-issue",
"status": "failed",
"displayStatus": "known-issue"
}
}
Expand Down
2 changes: 1 addition & 1 deletion graphql/tests/version/tasks/queries/all_params.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
blocked
buildVariant
displayName
status
displayStatus
}
count
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
id
executionTasksFull {
id
status
displayStatus
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
baseStatus
baseTask {
id
status
displayStatus
}
displayName
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
data {
id
displayName
status
displayStatus
}
count
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
tasks(options: { statuses: ["failed", "success"] }) {
data {
id
status
displayStatus
}
count
}
Expand Down
Loading

0 comments on commit 6a866c5

Please sign in to comment.