mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 17:27:31 +00:00
fix(cleanup): cleanup all stuck states (#7145)
* fix(setup): unmarshal of failed step * fix(cleanup): cleanup all stuck states * use lastRun for repeatable steps * typo --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
@@ -42,10 +42,10 @@ func Cleanup(config *Config) {
|
||||
es := eventstore.NewEventstore(config.Eventstore)
|
||||
migration.RegisterMappers(es)
|
||||
|
||||
step, err := migration.LatestStep(ctx, es)
|
||||
step, err := migration.LastStuckStep(ctx, es)
|
||||
logging.OnError(err).Fatal("unable to query latest migration")
|
||||
|
||||
if step.BaseEvent.EventType != migration.StartedType {
|
||||
if step == nil {
|
||||
logging.Info("there is no stuck migration please run `zitadel setup`")
|
||||
return
|
||||
}
|
||||
|
@@ -20,14 +20,11 @@ type externalConfigChange struct {
|
||||
defaults systemdefaults.SystemDefaults
|
||||
}
|
||||
|
||||
func (mig *externalConfigChange) SetLastExecution(lastRun map[string]interface{}) {
|
||||
func (mig *externalConfigChange) Check(lastRun map[string]interface{}) bool {
|
||||
mig.currentExternalDomain, _ = lastRun["externalDomain"].(string)
|
||||
externalPort, _ := lastRun["externalPort"].(float64)
|
||||
mig.currentExternalPort = uint16(externalPort)
|
||||
mig.currentExternalSecure, _ = lastRun["externalSecure"].(bool)
|
||||
}
|
||||
|
||||
func (mig *externalConfigChange) Check() bool {
|
||||
return mig.currentExternalSecure != mig.ExternalSecure ||
|
||||
mig.currentExternalPort != mig.ExternalPort ||
|
||||
mig.currentExternalDomain != mig.ExternalDomain
|
||||
|
@@ -8,18 +8,14 @@ import (
|
||||
)
|
||||
|
||||
type projectionTables struct {
|
||||
es *eventstore.Eventstore
|
||||
currentVersion string
|
||||
es *eventstore.Eventstore
|
||||
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
func (mig *projectionTables) SetLastExecution(lastRun map[string]interface{}) {
|
||||
mig.currentVersion, _ = lastRun["version"].(string)
|
||||
}
|
||||
|
||||
func (mig *projectionTables) Check() bool {
|
||||
return mig.currentVersion != mig.Version
|
||||
func (mig *projectionTables) Check(lastRun map[string]interface{}) bool {
|
||||
currentVersion, _ := lastRun["version"].(string)
|
||||
return currentVersion != mig.Version
|
||||
}
|
||||
|
||||
func (mig *projectionTables) Execute(ctx context.Context) error {
|
||||
|
Reference in New Issue
Block a user