feat: [CDE-992]: Fetch previous infra for start/resume requests (#4274)

* feat: [CDE-992]: fix lint (#4280)

* feat: [CDE-992]: fix lint

* feat: [CDE-992]: update disallowed when in error state

* feat: [CDE-992]: refactor

* feat: [CDE-992]: fix lint

* feat: [CDE-992]: refactor

* feat: [CDE-992]: refactor

* feat: [CDE-992]: update logs

* feat: [CDE-992]: Fetch previous infra for start/resume requests
This commit is contained in:
Vikyath Harekal 2025-08-12 08:34:36 +00:00 committed by Harness
parent 5d3e9b030a
commit 16b3b54cb3
5 changed files with 5 additions and 10 deletions

1
.gitignore vendored
View File

@ -24,6 +24,7 @@ dist
.yalc
yalc.lock
node_modules
.cursor
# ignore any executables we build
/gitness

View File

@ -179,11 +179,6 @@ func validateBootDiskChanges(existingMeta, newMeta map[string]string) (bool, err
return false, fmt.Errorf(
"invalid boot disk size format: cannot parse boot disk sizes for comparison")
}
if newVal < existingVal {
return false, usererror.BadRequestf(
"reducing boot disk size is not allowed: from %d to %d",
existingVal, newVal)
}
if newVal != existingVal {
markForHardReset = true
}

View File

@ -66,10 +66,9 @@ func (c *Controller) Update(
// Check the gitspace state. Update can be done only in stopped, error or uninitialized state
currentState := gitspaceConfig.State
if currentState != enum.GitspaceStateStopped &&
currentState != enum.GitspaceStateError &&
currentState != enum.GitspaceStateUninitialized {
return nil, usererror.BadRequest(
"Gitspace update can only be performed when gitspace is stopped, in error state, or uninitialized",
"Gitspace update can only be performed when gitspace is stopped or uninitialized",
)
}

View File

@ -214,7 +214,7 @@ func (i infraProvisionedStore) FindStoppedInfraForGitspaceConfigIdentifier(
SELECT gits.gits_id
FROM %s gits
JOIN %s conf ON gits.gits_gitspace_config_id = conf.gconf_id
WHERE conf.gconf_uid = '%s' AND gits.gits_state = 'starting'
WHERE conf.gconf_uid = '%s' AND (gits.gits_state = 'starting' OR gits.gits_state = 'pending_cleanup')
LIMIT 1`,
gitspaceInstanceTable, gitspaceConfigsTable, gitspaceConfigIdentifier)

View File

@ -598,7 +598,7 @@ func NewJSONStringStreamReader(r *bufio.Reader) io.Reader {
if escaped {
// Were inside an escape sequence — pass this byte through
// JSON escape sequences dont affect base64, but we handle it for correctness
//nolint: errcheck
//nolint: errcheck,gosec
pw.Write([]byte{b})
escaped = false
continue
@ -615,7 +615,7 @@ func NewJSONStringStreamReader(r *bufio.Reader) io.Reader {
}
// Normal base64 character
//nolint: errcheck
//nolint: errcheck,gosec
pw.Write([]byte{b})
}
}()