From 0fb7950cec3c83a2bfff53ce3be8aa5403ea42b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Th=C3=B6mmes?= Date: Thu, 8 Aug 2024 17:50:21 +0200 Subject: [PATCH] APPS-9201 Add `UpdateAllSourceVersions` parameter to update app calls (#708) This new parameter allows the `UpdateApp` call to cause an update of all sources (similar to how a `CreateDeployment` call would work), while also updating the spec in one call. --- apps.go | 2 ++ apps_test.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps.go b/apps.go index cd72f74..ebf341c 100644 --- a/apps.go +++ b/apps.go @@ -80,6 +80,8 @@ type AppLogs struct { // AppUpdateRequest represents a request to update an app. type AppUpdateRequest struct { Spec *AppSpec `json:"spec"` + // Whether or not to update the source versions (for example fetching a new commit or image digest) of all components. By default (when this is false) only newly added sources will be updated to avoid changes like updating the scale of a component from also updating the respective code. + UpdateAllSourceVersions bool `json:"update_all_source_versions"` } // DeploymentCreateRequest represents a request to create a deployment. diff --git a/apps_test.go b/apps_test.go index e86f808..eb743d3 100644 --- a/apps_test.go +++ b/apps_test.go @@ -345,11 +345,12 @@ func TestApps_UpdateApp(t *testing.T) { err := json.NewDecoder(r.Body).Decode(&req) require.NoError(t, err) assert.Equal(t, &updatedSpec, req.Spec) + assert.True(t, req.UpdateAllSourceVersions) json.NewEncoder(w).Encode(&appRoot{App: &testApp}) }) - app, _, err := client.Apps.Update(ctx, testApp.ID, &AppUpdateRequest{Spec: &updatedSpec}) + app, _, err := client.Apps.Update(ctx, testApp.ID, &AppUpdateRequest{Spec: &updatedSpec, UpdateAllSourceVersions: true}) require.NoError(t, err) assert.Equal(t, &testApp, app) }