Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixer reset #608

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ashleshaAtrey
Copy link
Contributor

It reverts the mix to a good state in case of a build failure or in case the user wants to roll back to a previous version.
By default, the command will bring back the mix to the same state it have when it last build a successful mix.
This value can be overridden if a --to flag is provided with a version number.The command will not be destructive unless a --clean flag is provided specified. If so, mixer will delete all files associated with versions that are bigger than the one provided. If not, only the values of the state files will change, but the files will be kept.

Signed-off-by: Ashlesha Atrey [email protected]

@ashleshaAtrey ashleshaAtrey force-pushed the mixerReset branch 3 times, most recently from 6ac0537 to 4d0e202 Compare September 10, 2019 21:56
@ashleshaAtrey ashleshaAtrey changed the title WIP: Mixer reset Mixer reset Sep 10, 2019
@ashleshaAtrey ashleshaAtrey force-pushed the mixerReset branch 5 times, most recently from 2a433a4 to e462906 Compare September 11, 2019 22:41
Copy link
Contributor

@rchiossi rchiossi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to update the docs to include this new command.

bat/tests/reset-command/run.bats Outdated Show resolved Hide resolved
builder/builder.go Outdated Show resolved Hide resolved
mixer/cmd/reset.go Outdated Show resolved Hide resolved
mixer/cmd/reset.go Outdated Show resolved Hide resolved
mixer/cmd/reset.go Outdated Show resolved Hide resolved
mixer/cmd/reset.go Outdated Show resolved Hide resolved
mixer/cmd/reset.go Outdated Show resolved Hide resolved
mixer/cmd/reset.go Outdated Show resolved Hide resolved
mixer/cmd/reset.go Outdated Show resolved Hide resolved
mixer/cmd/reset.go Outdated Show resolved Hide resolved
@ashleshaAtrey ashleshaAtrey force-pushed the mixerReset branch 6 times, most recently from 317b5c5 to 12eab83 Compare September 17, 2019 00:15
mixer/cmd/reset.go Outdated Show resolved Hide resolved
docs/mixer.1.rst Outdated Show resolved Hide resolved
mixer/cmd/reset.go Outdated Show resolved Hide resolved
mixer/cmd/reset.go Outdated Show resolved Hide resolved
@ashleshaAtrey ashleshaAtrey force-pushed the mixerReset branch 3 times, most recently from fd6eede to 7ca1bda Compare September 17, 2019 20:38
@ashleshaAtrey
Copy link
Contributor Author

I updated the docs, but I am not sure auto-completion. How do we enable that ?

mixer/cmd/reset.go Outdated Show resolved Hide resolved
mixer/cmd/reset.go Outdated Show resolved Hide resolved
if err = ioutil.WriteFile(filepath.Join(b.Config.Builder.ServerStateDir, "/www/version/", newFormat, "latest"), []byte(b.MixVer), 0644); err != nil {
return fmt.Errorf("couldn't update latest file: %s", err)
}
//update the sig file for the latest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually needs to be decided, whether we should update the sig file or not

if err = ioutil.WriteFile(filepath.Join(b.Config.Builder.ServerStateDir, "/www/version/", "latest_version"), []byte(b.MixVer), 0644); err != nil {
return fmt.Errorf("couldn't update latest_version file: %s", err)
}
//update the sig file for the latest_version
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for this, need to decide if updating the sig is a good idea or not

Copy link

@jwakre jwakre Jan 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think mixer reset should change these files. They should be updated by mixer build update. Also, when rolling back the version and re-building, I think that mixer should erase manifests at mix versions ahead of the current mix because they will be corrupted.

@reaganlo Thoughts?

mixer/cmd/reset.go Outdated Show resolved Hide resolved
mixer/cmd/reset.go Show resolved Hide resolved
}
}

if b.MixVer == "0"{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixversions are required to be > 0. Allowing a mix to be reset to 0 will lead to failures later.

mixer init
sudo mixer reset
sudo mixer build all
ERROR: Couldn't build update: failed to create update metadata: manifest has version zero, version must be positive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I will make it invalid to give reset 0 then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will be good approach to reset the mix to a state which is after mixer init?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the previous version is 0, I would use the current mixversion. If that is invalid (< 1), I would print a warning and default to 10 which is the mixer init mixversion default.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwakre can you test the recent commit. I made the changes.

@ashleshaAtrey ashleshaAtrey force-pushed the mixerReset branch 2 times, most recently from 847eede to 7901e1c Compare January 15, 2020 00:47
mixer/cmd/reset.go Outdated Show resolved Hide resolved
It reverts the mix to a previous version in case of a build failure or in case
the user wants to roll back to a specific version.
By default, the command will  bring back the mix to the same state
it have when it last build a successful mix.
This value can be overridden if a `--to` flag is provided with a version number.
The command will not be destructive unless a `--clean` flag is provided specified.
If so, mixer will delete all files associated with versions that are bigger than the one provided.
If not, only the values of the state files will change, but the files will be kept.

Signed-off-by: Ashlesha Atrey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants