-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
1 parent
4e76482
commit 7ca1bda
Showing
9 changed files
with
423 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.PHONY: check clean | ||
|
||
check: | ||
bats ./run.bats | ||
|
||
CLEANDIRS = ./update ./test-chroot ./logs ./.repos ./bundles ./update ./mix-bundles ./clr-bundles ./local-yum ./results ./repodata ./local-rpms ./upstream-bundles ./local-bundles | ||
CLEANFILES = ./*.log ./run.bats.trs ./yum.conf.in ./builder.conf ./mixer.state ./.{c,m}* *.pem .yum-mix.conf mixversion upstreamurl upstreamversion mixbundles | ||
clean: | ||
sudo rm -rf $(CLEANDIRS) $(CLEANFILES) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
reset | ||
==================== | ||
This test attempts to create multiple mixes of different versions | ||
in different format. It then tries to revert the mix to a previous stable | ||
version. If clean flag is set, mixer will delete all files associated with | ||
versions that are bigger than the one provided. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bats | ||
|
||
# shared test functions | ||
load ../../lib/mixerlib | ||
|
||
setup() { | ||
global_setup | ||
} | ||
|
||
@test "reset" { | ||
mixer-init-stripped-down latest 10 | ||
mixer build all --format 1 --native | ||
mixer-versions-update 20 latest | ||
mixer build all --format 2 --native | ||
mixer-versions-update 30 latest | ||
mixer build all --format 3 --native | ||
#check LAST_VER and PREVIOUS_MIX_VERSION match | ||
test $(< update/image/LAST_VER) -eq 30 | ||
test $(sed -n 's/[ ]*PREVIOUS_MIX_VERSION[ ="]*\([0-9]\+\)[ "]*/\1/p' mixer.state) -eq 20 | ||
mixer reset --to 20 | ||
#check LAST_VER and PREVIOUS_MIX_VERSION match | ||
test $(< update/image/LAST_VER) -eq 20 | ||
test $(sed -n 's/[ ]*PREVIOUS_MIX_VERSION[ ="]*\([0-9]\+\)[ "]*/\1/p' mixer.state) -eq 20 | ||
test -d "./update/www/30" | ||
test -d "./update/image/30" | ||
mixer reset --to 10 --clean | ||
#check LAST_VER and PREVIOUS_MIX_VERSION match | ||
test $(< update/image/LAST_VER) -eq 10 | ||
test $(sed -n 's/[ ]*PREVIOUS_MIX_VERSION[ ="]*\([0-9]\+\)[ "]*/\1/p' mixer.state) -eq 10 | ||
test ! -d "./update/www/20" | ||
test ! -d "./update/image/30" | ||
} | ||
# vi: ft=sh ts=8 sw=2 sts=2 et tw=80 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
.\" Man page generated from reStructuredText. | ||
. | ||
.TH MIXER.RESET 1 "" "" "" | ||
.SH NAME | ||
mixer.reset \- Reset mixer to a given or stable version | ||
. | ||
.nr rst2man-indent-level 0 | ||
. | ||
.de1 rstReportMargin | ||
\\$1 \\n[an-margin] | ||
level \\n[rst2man-indent-level] | ||
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] | ||
- | ||
\\n[rst2man-indent0] | ||
\\n[rst2man-indent1] | ||
\\n[rst2man-indent2] | ||
.. | ||
.de1 INDENT | ||
.\" .rstReportMargin pre: | ||
. RS \\$1 | ||
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] | ||
. nr rst2man-indent-level +1 | ||
.\" .rstReportMargin post: | ||
.. | ||
.de UNINDENT | ||
. RE | ||
.\" indent \\n[an-margin] | ||
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] | ||
.nr rst2man-indent-level -1 | ||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] | ||
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u | ||
.. | ||
.SH SYNOPSIS | ||
.sp | ||
\fBmixer reset [flags]\fP | ||
.SH DESCRIPTION | ||
.sp | ||
Reverts a mix state to the end of the last build or to the end | ||
of a given version build if one is provided. By default, the value | ||
of PREVIOUS_MIX_VERSION in mixer.state will be used to define the | ||
last build. This command can be used to roll back the mixer state | ||
in case of a build failure or in case the user wants to roll back | ||
to a previous version. | ||
.SH OPTIONS | ||
.sp | ||
In addition to the globally recognized \fBmixer\fP flags (see \fBmixer\fP(1) for | ||
more details), the following options are recognized. | ||
.INDENT 0.0 | ||
.IP \(bu 2 | ||
\fB\-\-to\fP | ||
.sp | ||
Reverts the mix to the version provided by the flag | ||
.IP \(bu 2 | ||
\fB\-\-clean\fP | ||
.sp | ||
Delete all files associated with versions that are bigger than the one provided. | ||
.IP \(bu 2 | ||
\fB\-h, \-\-help\fP | ||
.sp | ||
Display \fBreset\fP help information and exit. | ||
.UNINDENT | ||
.SH EXIT STATUS | ||
.sp | ||
On success, 0 is returned. A non\-zero return code indicates a failure. | ||
.SS SEE ALSO | ||
.INDENT 0.0 | ||
.IP \(bu 2 | ||
\fBmixer\fP(1) | ||
.UNINDENT | ||
.SH COPYRIGHT | ||
(C) 2019 Intel Corporation, CC-BY-SA-3.0 | ||
.\" Generated by docutils manpage writer. | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
=========== | ||
mixer.reset | ||
=========== | ||
|
||
---------------------------------------- | ||
Reset mixer to a given or stable version | ||
---------------------------------------- | ||
|
||
:Copyright: \(C) 2019 Intel Corporation, CC-BY-SA-3.0 | ||
:Manual section: 1 | ||
|
||
|
||
SYNOPSIS | ||
======== | ||
|
||
``mixer reset [flags]`` | ||
|
||
|
||
DESCRIPTION | ||
=========== | ||
|
||
Reverts a mix state to the end of the last build or to the end | ||
of a given version build if one is provided. By default, the value | ||
of PREVIOUS_MIX_VERSION in mixer.state will be used to define the | ||
last build. This command can be used to roll back the mixer state | ||
in case of a build failure or in case the user wants to roll back | ||
to a previous version. | ||
|
||
OPTIONS | ||
======= | ||
|
||
In addition to the globally recognized ``mixer`` flags (see ``mixer``\(1) for | ||
more details), the following options are recognized. | ||
|
||
- ``--to`` | ||
|
||
Reverts the mix to the version provided by the flag | ||
|
||
- ``--clean`` | ||
|
||
Delete all files associated with versions that are bigger than the one provided. | ||
|
||
- ``-h, --help`` | ||
|
||
Display ``reset`` help information and exit. | ||
|
||
|
||
EXIT STATUS | ||
=========== | ||
|
||
On success, 0 is returned. A non-zero return code indicates a failure. | ||
|
||
SEE ALSO | ||
-------- | ||
|
||
* ``mixer``\(1) |
Oops, something went wrong.