Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 4e3ed98
Author: Zackary Santana <[email protected]>
Date:   Thu Jan 30 13:34:26 2025 -0500

    Revert "DEVPROD-13976 Add otel to presign file func (evergreen-ci#8673)"

    This reverts commit c856008.

commit c856008
Author: Zackary Santana <[email protected]>
Date:   Thu Jan 30 09:30:17 2025 -0500

    DEVPROD-13976 Add otel to presign file func (evergreen-ci#8673)

commit 6d420a2
Author: Sophie Stadler <[email protected]>
Date:   Wed Jan 29 14:35:01 2025 -0500

    DEVPROD-12696: Parallelize waterfall queries (evergreen-ci#8672)
  • Loading branch information
ZackarySantana committed Jan 30, 2025
1 parent cad380e commit 8f262b0
Show file tree
Hide file tree
Showing 10 changed files with 518 additions and 79 deletions.
222 changes: 203 additions & 19 deletions graphql/generated.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions graphql/schema/types/version.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type Version {
upstreamProject: UpstreamProject
versionTiming: VersionTiming
warnings: [String!]!
waterfallBuilds: [WaterfallBuild!]
}

type VersionTasks {
Expand Down
2 changes: 1 addition & 1 deletion graphql/schema/types/waterfall.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type WaterfallTask {

type WaterfallBuild {
id: String!
activated: Boolean
buildVariant: String!
displayName: String!
version: String!
tasks: [WaterfallTask!]!
Expand Down
20 changes: 12 additions & 8 deletions graphql/tests/query/waterfall/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
"order": 40,
"create_time": {
"$date": "2019-12-31T00:00:03Z"
},
"build_variants_status": {
"activated": false,
"build_id": "evergreen_version1_build",
"build_variant": "enterprise-ubuntu1604-64"
}
},
{
Expand All @@ -47,7 +42,10 @@
"activated": true,
"build_id": "evergreen_version1_build",
"build_variant": "enterprise-ubuntu1604-64"
}
},
"builds": [
"evergreen_version1_build"
]
},
{
"_id": "evergreen_version2",
Expand All @@ -65,7 +63,10 @@
"activated": true,
"build_id": "evergreen_version2_build",
"build_variant": "enterprise-ubuntu1604-64"
}
},
"builds": [
"evergreen_version2_build"
]
},
{
"_id": "evergreen_version3",
Expand Down Expand Up @@ -109,7 +110,10 @@
"order": 45,
"create_time": {
"$date": "2020-01-05T12:00:00Z"
}
},
"builds": [
"evergreen_version3_build"
]
},
{
"_id": "inactive1",
Expand Down
1 change: 0 additions & 1 deletion graphql/tests/query/waterfall/queries/no_filters.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
waterfall(options: { projectIdentifier: "spruce-identifier" }) {
buildVariants {
builds {
activated
id
tasks {
id
Expand Down
17 changes: 17 additions & 0 deletions graphql/tests/query/waterfall/queries/waterfall_builds.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
waterfall(options: { projectIdentifier: "spruce-identifier" }) {
flattenedVersions {
id
waterfallBuilds {
buildVariant
id
displayName
version
tasks {
id
displayName
}
}
}
}
}
89 changes: 86 additions & 3 deletions graphql/tests/query/waterfall/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"displayName": "01 Ubuntu 16.04",
"builds": [
{
"activated": true,
"id": "evergreen_version1_build",
"tasks": [
{
Expand All @@ -32,7 +31,6 @@
"version": "evergreen_version1"
},
{
"activated": true,
"id": "evergreen_version2_build",
"tasks": [
{
Expand All @@ -57,7 +55,6 @@
{
"builds": [
{
"activated": true,
"id": "evergreen_version3_build",
"tasks": [
{
Expand Down Expand Up @@ -653,6 +650,92 @@
}
}
}
},
{
"query_file": "waterfall_builds.graphql",
"result": {
"data": {
"waterfall": {
"flattenedVersions": [
{
"id": "evergreen_version5",
"waterfallBuilds": [
{
"id": "evergreen_version3_build",
"buildVariant": "lint",
"displayName": "03 Linter",
"tasks": [
{
"id": "task_5",
"displayName": "Task Number 5"
}
],
"version": "evergreen_version5"
}
]
},
{
"id": "evergreen_version4",
"waterfallBuilds": null
},
{
"id": "evergreen_version3",
"waterfallBuilds": []
},
{
"id": "evergreen_version2",
"waterfallBuilds": [
{
"id": "evergreen_version2_build",
"buildVariant": "enterprise-ubuntu1604-64",
"displayName": "02 Ubuntu 16.04",
"tasks": [
{
"id": "task_3",
"displayName": "Some Task"
},
{
"id": "task_4",
"displayName": "Some Other Task"
}
],
"version": "evergreen_version2"
}
]
},
{
"id": "evergreen_version1",
"waterfallBuilds": [
{
"id": "evergreen_version1_build",
"buildVariant": "enterprise-ubuntu1604-64",
"displayName": "01 Ubuntu 16.04",
"tasks": [
{
"id": "task_1",
"displayName": "Some Task"
},
{
"id": "task_2",
"displayName": "Some Other Task"
}
],
"version": "evergreen_version1"
}
]
},
{
"id": "evergreen_version0",
"waterfallBuilds": null
},
{
"id": "evergreen_version39",
"waterfallBuilds": []
}
]
}
}
}
}
]
}
22 changes: 22 additions & 0 deletions graphql/version_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,28 @@ func (r *versionResolver) Warnings(ctx context.Context, obj *restModel.APIVersio
return v.Warnings, nil
}

// WaterfallBuilds is the resolver for the waterfallBuilds field.
func (r *versionResolver) WaterfallBuilds(ctx context.Context, obj *restModel.APIVersion) ([]*model.WaterfallBuild, error) {
versionId := utility.FromStringPtr(obj.Id)

// No need to fetch build variants for unactivated versions
if !utility.FromBoolPtr(obj.Activated) {
return nil, nil
}

versionBuilds := []*model.WaterfallBuild{}
builds, err := model.GetVersionBuilds(ctx, versionId)
if err != nil {
return nil, InternalServerError.Send(ctx, fmt.Sprintf("getting version build variants: %s", err.Error()))
}

for _, b := range builds {
bCopy := b
versionBuilds = append(versionBuilds, &bCopy)
}
return versionBuilds, nil
}

// Version returns VersionResolver implementation.
func (r *Resolver) Version() VersionResolver { return &versionResolver{r} }

Expand Down
Loading

0 comments on commit 8f262b0

Please sign in to comment.