diff --git a/houston/deployment.go b/houston/deployment.go index 32c5d5a68..917a0d6f4 100644 --- a/houston/deployment.go +++ b/houston/deployment.go @@ -27,7 +27,7 @@ type ListDeploymentLogsRequest struct { type UpdateDeploymentImageRequest struct { ReleaseName string `json:"releaseName"` Image string `json:"image"` - AirflowVersion string `json:"airflowVersion"` + AirflowVersion string `json:"airflowVersion,omitempty"` RuntimeVersion string `json:"runtimeVersion"` } @@ -769,17 +769,31 @@ var ( } }` - DeploymentInfoRequest = ` - query DeploymentInfo { - deploymentConfig { - airflowImages { - version - tag - } - airflowVersions - defaultAirflowImageTag - } - }` + DeploymentInfoRequest = queryList{ + { + version: "0.25.0", + query: ` + query DeploymentInfo { + deploymentConfig { + airflowImages { + version + tag + } + airflowVersions + defaultAirflowImageTag + } + }`, + }, + { + version: "1.0.1", + query: ` + query DeploymentInfo { + deploymentConfig { + __typename + } + }`, + }, + } DeploymentLogsGetRequest = ` query GetLogs( @@ -800,24 +814,47 @@ var ( } }` - DeploymentImageUpdateRequest = ` - mutation updateDeploymentImage( - $releaseName:String!, - $image:String!, - $airflowVersion:String, - $runtimeVersion:String, - ){ - updateDeploymentImage( - releaseName:$releaseName, - image:$image, - airflowVersion:$airflowVersion, - runtimeVersion:$runtimeVersion - ){ - releaseName - airflowVersion - runtimeVersion - } - }` + DeploymentImageUpdateRequest = queryList{ + { + version: "0.25.0", + query: ` + mutation updateDeploymentImage( + $releaseName:String!, + $image:String!, + $airflowVersion:String, + $runtimeVersion:String, + ){ + updateDeploymentImage( + releaseName:$releaseName, + image:$image, + airflowVersion:$airflowVersion, + runtimeVersion:$runtimeVersion + ){ + releaseName + airflowVersion + runtimeVersion + } + }`, + }, + { + version: "1.0.1", + query: ` + mutation updateDeploymentImage( + $releaseName:String!, + $image:String!, + $runtimeVersion:String, + ){ + updateDeploymentImage( + releaseName:$releaseName, + image:$image, + runtimeVersion:$runtimeVersion + ){ + releaseName + runtimeVersion + } + }`, + }, + } UpdateDeploymentRuntimeRequest = ` mutation updateDeploymentRuntime($deploymentUuid: Uuid!, $desiredRuntimeVersion: String!) { @@ -986,8 +1023,9 @@ func (h ClientImplementation) UpdateDeploymentAirflow(variables map[string]inter // GetDeploymentConfig - get a deployment configuration func (h ClientImplementation) GetDeploymentConfig(_ interface{}) (*DeploymentConfig, error) { + reqQuery := DeploymentInfoRequest.GreatestLowerBound(version) dReq := Request{ - Query: DeploymentInfoRequest, + Query: reqQuery, } resp, err := dReq.DoWithClient(h.client) @@ -1014,8 +1052,9 @@ func (h ClientImplementation) ListDeploymentLogs(filters ListDeploymentLogsReque } func (h ClientImplementation) UpdateDeploymentImage(updateReq UpdateDeploymentImageRequest) (interface{}, error) { + reqQuery := DeploymentImageUpdateRequest.GreatestLowerBound(version) req := Request{ - Query: DeploymentImageUpdateRequest, + Query: reqQuery, Variables: updateReq, } diff --git a/houston/deployment_test.go b/houston/deployment_test.go index bc79d356f..8f7e651ea 100644 --- a/houston/deployment_test.go +++ b/houston/deployment_test.go @@ -664,8 +664,7 @@ func (s *Suite) TestUpdateDeploymentImage() { Data: ResponseData{ UpdateDeploymentImage: UpdateDeploymentImageResp{ ReleaseName: "prehistoric-gravity-930", - AirflowVersion: "2.2.0", - RuntimeVersion: "", + RuntimeVersion: "6.0.0", }, }, } @@ -682,7 +681,7 @@ func (s *Suite) TestUpdateDeploymentImage() { }) api := NewClient(client) - _, err := api.UpdateDeploymentImage(UpdateDeploymentImageRequest{ReleaseName: mockDeployment.Data.UpdateDeploymentImage.ReleaseName, AirflowVersion: mockDeployment.Data.UpdateDeploymentImage.AirflowVersion}) + _, err := api.UpdateDeploymentImage(UpdateDeploymentImageRequest{ReleaseName: mockDeployment.Data.UpdateDeploymentImage.ReleaseName, RuntimeVersion: "6.0.0"}) s.NoError(err) }) @@ -696,7 +695,7 @@ func (s *Suite) TestUpdateDeploymentImage() { }) api := NewClient(client) - _, err := api.UpdateDeploymentImage(UpdateDeploymentImageRequest{ReleaseName: mockDeployment.Data.UpdateDeploymentImage.ReleaseName, AirflowVersion: mockDeployment.Data.UpdateDeploymentImage.AirflowVersion}) + _, err := api.UpdateDeploymentImage(UpdateDeploymentImageRequest{ReleaseName: mockDeployment.Data.UpdateDeploymentImage.ReleaseName, RuntimeVersion: "6.0.0"}) s.Contains(err.Error(), "Internal Server Error") }) } diff --git a/houston/types.go b/houston/types.go index 92c2cd2ce..e8f73a83d 100644 --- a/houston/types.go +++ b/houston/types.go @@ -307,7 +307,6 @@ type AirflowImage struct { type UpdateDeploymentImageResp struct { ReleaseName string `json:"releaseName"` - AirflowVersion string `json:"airflowVersion"` RuntimeVersion string `json:"runtimeVersion"` } diff --git a/software/deploy/deploy_test.go b/software/deploy/deploy_test.go index a9a53a719..775766805 100644 --- a/software/deploy/deploy_test.go +++ b/software/deploy/deploy_test.go @@ -1234,7 +1234,6 @@ func (s *Suite) TestUpdateDeploymentImage() { } updateDeploymentImageResp := &houston.UpdateDeploymentImageResp{ ReleaseName: releaseName, - AirflowVersion: "", RuntimeVersion: runtimeVersion, } deployment := &houston.Deployment{