Skip to content

Commit

Permalink
APPS-9201 Add UpdateAllSourceVersions parameter to update app calls (
Browse files Browse the repository at this point in the history
…#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.
  • Loading branch information
markusthoemmes authored Aug 8, 2024
1 parent e56b8a3 commit 0fb7950
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 0fb7950

Please sign in to comment.