-
Notifications
You must be signed in to change notification settings - Fork 17
Convert bootstrap shell and bat files to a common Python file. #208
Conversation
@iamveritas Please review (run) OSX tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That code is so pleasant to read now, thanks Scott.
However it seems, that if we have already existing image then running bootstrap.py
doesn't change the leap version.
Example:
1st run works ok:
mikel@msi:~/repo/DUNE$ ./bootstrap.py --leap 3.2.2
[+] Building 320.3s (26/26) FINISHED
(...) => => naming to docker.io/library/dunes 0.0s
mikel@msi:~/repo/DUNE$ ./dunes --version-all
Creating docker container [dunes_container]
DUNES v1.1.2
Listing... Done
leap/now 3.2.2 amd64 [installed,local]
Listing... Done
cdt/now 4.0.0-1 amd64 [installed,local]
# now the second run seems not to change leap version:
mikel@msi:~/repo/DUNE$ ./bootstrap.py --leap 3.2.3
[+] Building 291.3s (26/26) FINISHED
(...)
=> => naming to docker.io/library/dunes 0.0s
mikel@msi:~/repo/DUNE$ ./dunes --version-all
DUNES v1.1.2
Listing... Done
leap/now 3.2.2 amd64 [installed,local]
Listing... Done
cdt/now 4.0.0-1 amd64 [installed,local]
mikel@msi:~/repo/DUNE$
In the second bootstrap.py I'm trying to change leap 3.2.2 to leap 3.2.3. However, old 3.2.2 is still installed.
/edit
Tested on Windows. It seems the same issue is for leap on Windows.
However --cdt
on Windows worked properly.
I'm not sure you are describing a defect. A running container uses the image it's started with. That's not necessarily something we can or should change... I have added tests to start multiple containers and test that they include the correct versions of leap and cdt. |
You are right, bootstrap shouldn't change the existing container. I have checked this works as expected on Linux and Windows now - thanks. |
…t more self contained in image bootstrap test.
tests/z9999_image_bootstrap_test.py
Outdated
This script tests that the bootstrap command can create an image with a given version. | ||
|
||
This test contains resource intense tests that should NOT be run on every commit. | ||
To disable during ci testing, add `-k "not non_ci"` to your pytest command (e.g. `pytest -k "not non_ci" tests`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To disable during ci testing, add `-k "not non_ci"` to your pytest command (e.g. `pytest -k "not non_ci" tests`) | |
To disable during ci testing, add `-k "not expensive"` to your pytest command (e.g. `pytest -k "not expensive" tests`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is overcome by the latest change, I believe.
images = subprocess.check_output(['docker', 'images', '-q', repo_name], stderr=None, encoding='utf-8').strip().split('\n') | ||
for myimg in images: | ||
# pylint: disable=subprocess-run-check | ||
subprocess.run(['docker', 'image', 'rm', myimg, '--force'], stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL, check=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is very dangerous for the user - it will remove all dunes
images, even the running ones.
Remember, we are attaching those tests to the release as well.
I preferred the previous solution, where bootstrap.py
had to be executed manually (or by CI script). And even if it was executed, it did not alter running images. What was the issue with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A number of the existing tests are also destructive and will destroy a container. I believe the latest commit (with destructive
marking) corrects this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran python3 bootstrap.py
on this PR's branch locally without errors.
Adding conftest.py to disable auto run of desctrictive and slow tests. Updating workflows to run destructive tests, but not slow ones.
@@ -107,7 +107,7 @@ $ echo "PATH=<LocationOfDUNES>:$PATH" >> .bashrc | |||
If you want to rebuild the DUNES image pick your preferred terminal application and input the following command: | |||
|
|||
```console | |||
<PathToDUNES>/DUNES$ ./bootstrap.sh | |||
<PathToDUNES>/DUNES$ python3 ./bootstrap.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If bootstrap.py has an "execute" permission may be it would be better to remove python3 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should probably leave it here for windows users? It doesn't hurt to have it, I don't think.
Co-authored-by: Alexander Molchevsky <[email protected]>
Co-authored-by: Alexander Molchevsky <[email protected]>
I run
The same happens when I'm starting tests or running |
I managed to fix this, so please disregard above comment. I think the reason was that I had some leftovers from tests in |
How does it work currently if I simply run |
This is fixed in 620ba5f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work Scott!
--release
flag.destructive
orsafe
.slow
marker for disabling tests in CI.--run-destructive
to pytest command so tests could be developed to execute non-ci or periodically only.Will close #202