CI: Test remaining install methods#280
Conversation
83dad45 to
788329b
Compare
|
/test |
|
This is weird. Even though kata-containers/tests#839 has now landed, Travis is showing: I don't know where that is coming from: |
788329b to
0e2b18f
Compare
|
/test |
63be14d to
e144a6e
Compare
|
/test |
|
Hopefully, the Travis failure will be fixed by #282... |
e144a6e to
4a4f72e
Compare
|
#282 now merged. Let's see what falls over now... /test |
|
Ping @kata-containers/documentation - the doc change on this PR is actually a NOP (specifically to trigger the code changes on this PR :) However, it would be good to get this test code reviewed and hopefully landed today/tomorrow so that we have a safety net on the remaining install doc methods. /cc @egernst. |
|
/test |
Converted the plain code blocks in `install/installing-with-kata-doc-to-script.md` to bash code blocks so that they are executable by... `kata-doc-to-script.sh`. Also, removed the backslashes to let github render scroll bars for consistency with other docs. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
4a4f72e to
13f1821
Compare
|
/test |
13f1821 to
acac089
Compare
|
/test |
|
CI passing! Please review folks :) |
|
lgtm |
grahamwhaley
left a comment
There was a problem hiding this comment.
Some minor queries, but don't need to be blocking, so
lgtm
.ci/test-install-docs.sh
Outdated
|
|
||
| [ ! -e "$GOPATH" ] && die "cannot find $mgr" | ||
|
|
||
| source /etc/os-release |
There was a problem hiding this comment.
Expand to cover the multiple potential source files as discussed on kata-containers/tests#589, maybe like:
source /etc/os-release || source /usr/lib/os-release
| { | ||
| source /etc/os-release || source /usr/lib/os-release | ||
|
|
||
| mkdir -p "${GOPATH}" |
There was a problem hiding this comment.
I dunno if this will fail if GOPATH already exists? If so, a || true type fix I guess?
There was a problem hiding this comment.
Actually, no, -p won't fail if it exists.
| # Grab a copy of the tests repository | ||
| get_tests_repo() | ||
| { | ||
| [ -d "${test_repo_dir}" ] && return |
There was a problem hiding this comment.
I doubt we need to, but if it already exists, should we do a pull/fetch on it to make sure it is upto date?
There was a problem hiding this comment.
Good question but this test is only designed to run under the CI where everything is fresh.
There was a problem hiding this comment.
I tend to agree with Graham, sometimes I use CI scripts locally, not required in this PR we can let the user update test repository manually.
|
|
||
| local tmp_dir | ||
|
|
||
| tmp_dir=$(mktemp -d) |
There was a problem hiding this comment.
Do we ever finally delete the tmp_dir? Maybe a TRAP hook like we use elsewhere might do it?
There was a problem hiding this comment.
Yes, I'll fix that for when running with -t...
There was a problem hiding this comment.
If it is fixed can you remove the FIXME?
| $ bash "./${ID}-install.sh" | ||
| ``` | ||
|
|
||
| For example, if your distribution is CentOS, the previous example will generate a runnable shell script called `centos-install.sh`. |
There was a problem hiding this comment.
Would it make sense to separate the bash "./${ID}... command in a dedicate session?
E.g. For example, if your distribution is CentOS, the previous example will generate a runnable shell script called centos-install.sh. To proceed wit the installation, simply run:
$ bash "./${ID}-install.sh"There was a problem hiding this comment.
Sure - I can do that. We'll have to source the os-release file yet again of course... ;)
| { | ||
| [ -n "$TRAVIS" ] && info "Not testing install guide as Travis lacks modern distro support and VT-x" && return | ||
| if [ -n "$TRAVIS" ] | ||
| then |
There was a problem hiding this comment.
about the code style :), isn't if [...]; then more widely used in kata scripts than having then on its own line?
There was a problem hiding this comment.
We don't prescribe a coding style atm. However, we could if anyone wants to work on a new doc (and fight all the fights to get it landed :), or maybe it could be an update to:
.ci/test-install-docs.sh
Outdated
|
|
||
| pushd "${kata_project_dir}" | ||
| git clone "${test_repo_url}" | ||
| popd |
There was a problem hiding this comment.
just fyi :) you could also do git clone "${test_repo_url}" "${kata_project_dir}"
There was a problem hiding this comment.
Sure. Trying to keep the code as simple as possible.
There was a problem hiding this comment.
Oh - sorry, yes - I'll do that...
.ci/test-install-docs.sh
Outdated
| delete_kata_repos() | ||
| { | ||
| [ -n "${KATA_DEV_MODE}" ] && die "Not continuing - this is a dev system" | ||
| [ -z "${CI}" ] && die "Not continuing - not running in a CI environment" |
There was a problem hiding this comment.
not running in a non-CI environment
acac089 to
940c32c
Compare
|
Branch updated. /test |
|
One ack required and we can sleep easy knowing all the install methods are being tested... :) |
|
BTW, @egernst, @gnawux, @jcvenegas - what do you think about us re-running all these tests on If so, I'll raise a new PR to update https://github.com/kata-containers/documentation/blob/master/Release-Checklist.md. Ideally, we'd tag the branch or similar to show that it passed all CI tests for the already-released set of packages. Related: |
|
@jodh-intel I would like to have a test like that, I was wondering if OBS allow to know if a new build was done, and have a jenkins pipeline to autotest the installation |
|
@jcvenegas - pipeline sounds like a good idea! @chavafg - did you make any progress on reworking our CI code to support pipelines? |
jcvenegas
left a comment
There was a problem hiding this comment.
LGTM a few comments but I think nothing that blocks this PR
| # Grab a copy of the tests repository | ||
| get_tests_repo() | ||
| { | ||
| [ -d "${test_repo_dir}" ] && return |
There was a problem hiding this comment.
I tend to agree with Graham, sometimes I use CI scripts locally, not required in this PR we can let the user update test repository manually.
|
|
||
| local cwd="$PWD" | ||
|
|
||
| info "Deleting all local kata repositories below ${kata_project_dir}" |
There was a problem hiding this comment.
This should be a warning with a big red button :D
There was a problem hiding this comment.
As shown in the code, we only do this if running under a CI and developer mode is not enabled.
|
|
||
| local tmp_dir | ||
|
|
||
| tmp_dir=$(mktemp -d) |
There was a problem hiding this comment.
If it is fixed can you remove the FIXME?
| bash "${doc_to_script}" "${file_path}" "${script_file_path}" | ||
| done | ||
|
|
||
| reexec_in_tmpdir "${tmp_dir}" |
There was a problem hiding this comment.
This is confusing :P thanks for document it
|
@jcvenegas - regarding your comment on The script is only designed to run in a clean CI environment so that's why I don't think it's worth checking if the repo needs updating. |
|
@jcvenegas @jodh-intel yes, we can create a pipeline for this. Would this be for the complete release process? or just part of it? seems like it might help? |
|
/test |
|
@egernst - could you tal when you get a chance? It would be great to get these tests running :) |
Update the `kata-doc-to-script` install document to actually execute the generated scripts, allowing the entire installation to be tested by the CI. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Make the variable in the `info()` function a `local` one. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Folded the overly-long Travis check line in `check_install_guides()`. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Rename the `check_install_guides()` function to `check_install_docs()` and clean up: - Improve messages. - Add more braces around variables. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Rework the logic in `check_install_docs()` to make the intention clearer and support adding additional tests. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Create a `setup()` function in the test script used to test the install documents. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
The script used to test the install docs does not actually use the golang binary (it only uses the `GOPATH` variables) so remove the unnecessary call to `go`. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Split out a function to create a container from `test_distro_install_guide() in the script used to test install docs. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Make `setup()` clone the tests repo and check for the `kata-manager` script. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Wrap the function calls in the doc test script in a `main()` function to simplify future changes. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Add new CI tests to ensure that the following installation methods are also tested: - "Automatic" method ([`kata-manager`](https://github.com/kata-containers/tests/tree/master/cmd/kata-manager)) - "Scripted" method ([`kata-doc-to-script`](https://github.com/kata-containers/tests/blob/master/.ci/kata-doc-to-script.sh)) **Note:** the "Automatic" method is **not** the same as the existing `kata-manager` test: the existing test executes the "Manual" installation method (which runs `kata-manager` to execute the appropriate distro-specific install guide). However, this new test executes the `install/installing-with-kata-manager.md` document, which subsequently calls the `kata-manager` script. Since the "Automatic" and "Scripted" installation methods are designed to run "standalone" (without requiring any local git repo clones), the script which runs these new tests has to take care to ensure the environment they run in is clean. It does this by using the following approach: - Removes any local Kata github repos from the standard `GOPATH` locations (to ensure the scripts do not inadvertently access local files) [1]. - Creates a temporary directory containing: - A copy of *itself*. - The scripts it generated from the "Automatic" and "Scripted" installation documents. - Re-exec's itself to run the version in the temporary directory, passing an option that tells itself to simply execute the scripts in the specified directory. - It then runs the scripts in the directory specified. --- [1] - Since the recursive delete of all local Kata github repos is potentially dangerous, the test will immediately fail if the standard `KATA_DEV_MODE` variable is set (since this denotes a developer system) and will also fail unless the standard `CI` variable is set (denoting the script is running in a Continuous Integration environment, such as JenkinsCI. Fixes kata-containers#278. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
940c32c to
2f07105
Compare
|
All comments responded to I think. |
|
/test |
|
lgtm /test ping @egernst. |
|
Ah - we have full approval - a miracle! ;) |
|
/test |
|
all passing merging ... |
Chrony service is not started because it requires a private temporal directory, these directories can't be created in read-only filesystems. Create a symlink to /tmp in /var allowing systemd to create private temporal directories. fixes kata-containers#280 Signed-off-by: Julio Montes <julio.montes@intel.com>
Add new CI tests to ensure that the following installation methods are
also tested:
kata-manager)kata-doc-to-script)Note: the "Automatic" method is not the same as the existing
kata-managertest: the existing test executes the "Manual"installation method (which runs
kata-managerto execute theappropriate distro-specific install guide). However, this new test
executes the
install/installing-with-kata-manager.mddocument, whichsubsequently calls the
kata-managerscript.Since the "Automatic" and "Scripted" installation methods are designed
to run "standalone" (without requiring any local git repo clones), the
script which runs these new tests has to take care to ensure the
environment they run in is clean. It does this by using the following
approach:
GOPATHlocations (to ensure the scripts do not inadvertently access local
files) [1].
passing an option that tells itself to simply execute the scripts in
the specified directory.
[1] - Since the recursive delete of all local Kata github repos is
potentially dangerous, the test will immediately fail if the standard
KATA_DEV_MODEvariable is set (since this denotes a developer system)and will also fail unless the standard
CIvariable is set (denotingthe script is running in a Continuous Integration environment, such as
JenkinsCI.
Also includes commits to refactor the existing install doc test code and drop the dependency on using golang.
Fixes #278.
Signed-off-by: James O. D. Hunt james.o.hunt@intel.com